Notice: Constant WP_MEMORY_LIMIT already defined in /home/javawith/public_html/ on line 107

Notice: Constant WP_MAX_MEMORY_LIMIT already defined in /home/javawith/public_html/ on line 108
PHP Delete File - CodesJava


Easy learning with example program codes

PHP Delete File

Notice: Undefined variable: footnotelist in /home/javawith/public_html/ on line 475

To delete a file in PHP, unlink() function is used. PHP unlink() function behaves same as UNIX C unlink() function. If the file is deleted successfully, it generates a TRUE value. If the file is not deleted successfully it generates a FALSE value or returns an E_WARNING level error.


bool unlink ( string $filename, context )

Filename:  This is a mandatory parameter which specifies the name of the file to be deleted.

Context:   This is an optional parameter which specifies the context (set of options to modify a stream’s behaviour ) of the file handle.


<!DOCTYPE html>
echo "File deleted.";    
echo "Unable to Delete the File.";    


File deleted.
Please follow and like us:
Posted in PHP   

Copyright © 2019 CodesJava Protection Status