note 27150 deleted from function.unlink by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 11 Aug 2004 23:18:47 +0000 |
| Subject: | note 27150 deleted from function.unlink by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74507@lists.php.net to get a copy of this message | ||
Note Submitter: bjorn AT smokingmusic DOT com
----
in follow up to icecube at fr dot fm
and the comment about clearstatcache()...
.... so that would make the 'delete function' like this:
function delete_file($file){
$delete = @unlink($file);
clearstatcache();
if (@file_exists($file)) {
$filesys = eregi_replace("/","\\",$file);
$delete = @system("del $filesys");
clearstatcache();
if (@file_exists($file)) {
$delete = @chmod ($file, 0775);
$delete = @unlink($file);
$delete = @system("del $filesys");
}
}
clearstatcache();
if (@file_exists($file)){
return false;
}
else{
return true;
}
} // end function