File Delete

File Delete


Posted in : PHP Posted on : January 6, 2011 at 4:50 PM Comments : [ 0 ]

This section contains the detail about deleting file in PHP.

File Delete

In PHP, file can be delete using unlink() function. The unlink() function need only the file name to be delete.

But you must ensure that it is not open in your program. You can use fclose() to close the open file.

Given below example code delete the file "NewtestFile.txt" as follows :

<?php
$myFileName = 'C:\NewtestFile.txt';
unlink($myFileName);
echo "File deleted successfully";
?>

Output :

File deleted successfully

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics