Skip to content

Unlink File in Codeigniter

Last updated on January 17, 2018

You can delete files from the server with PHP’s file system function unlink() which will delete or remove the files. It can remove all type of files like images, document, media files .. etc.It will return TRUE on success or FALSE on failure.If there is a problem, it is most likely because you do not have permission to delete the file.The directory must be writable by the user in order to remove the file.File not required write permissions.

I am gonna use is_readable() function which tells whether a file exists and is readable or not, It is better to check before attempting to delete action.

For example, if you want to delete files from upload folder(which is located at web server root folder).


That's it.

0 0 votes
Article Rating
Subscribe
Notify of
guest

7 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments