Delete a file using php

In previous post we talked about moving a file. Lets see how to delete a file using php. We have an built-in function for our help unlink().

If the file you intended to delete doesnt exists, php will throw an error ‘No such file or directory’. We can avoid this by setting a simple mechanism to check whether the file exists or not using function file_exists().

Posted in: PHP