Skip to main content

PHP File Handling: Delete File

Body

In our previous tutorial, we have seen how to write the file and read the file, and we also know how to open a file in an assortment of different ways. At this time we’re going to focus on how to destroy(delete) files. Deleting is too simple but we need to keep two things in mind.

1. Close the file – because we can’t delete the open files
2. Must have permission on the folder containing the file – we have to make sure that the directory is writable, we could create the file, so we have also to make sure that we could delete the file.

When you are navigating and viewing the contents of

Add new comment