Saturday, September 30, 2017

PHP Delete File

In PHP, we can delete any file using unlink() function.

PHP unlink() generates E_WARNING level error if file is not deleted. It returns TRUE if file is deleted successfully otherwise FALSE.

bool unlink ( string $filename [, resource $context ] )

Unlink() function accepts only one argument.
$filename represents the name of the file to be deleted.

PHP Example to Delete file :
   echo "File deleted successfully";    
   echo "Sorry! Something wrong in it";    

File deleted successfully

No comments:

Post a Comment