PHP Directories Deleting a File - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript PHP Directories Deleting a File - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript

Breaking

Post Top Ad

Post Top Ad

Monday, July 15, 2019

PHP Directories Deleting a File

PHP Directories


Deleting a File

Problem

You want to delete a file.

Solution

Use unlink():

       $file = '/tmp/junk.txt';
       unlink($file) or die ("can't delete $file: $php_errormsg");

Discussion

The unlink() function is only able to delete files that the user of the PHP process is able to delete. If you’re having trouble getting unlink() to work, check the permissions on the file and how you’re running PHP.

No comments:

Post a Comment

Post Top Ad