DEV Community

Julian
Julian

Posted on

How to delete a file uploaded in database

To delete a file loaded on a server, we must enter the following code in our program:

// We proceed to delete
if (! unlink ('uploads /'.$ file)) {
// print error when deleting
echo 'Error deleting';
} else {
// File deleted
echo 'File deleted';
}

Top comments (0)