note 80110 modified in function.delete by danbrown
| From: | danbrown@php.net | Date: | Wed, 26 Nov 2008 16:41:25 +0000 |
| Subject: | note 80110 modified in function.delete by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146990@lists.php.net to get a copy of this message | ||
I have founda that trying to delete a file using relative path like the example below does not work.
<?php
$do = unlink("../pics/$fileToDel");
if($do=="1"){
echo "The file was deleted successfully.";
} else { echo "There was an error trying to delete the file."; }
?>
I did not work at all, instead what I had to do was:
<?php
chdir('../pics/');
$do = unlink($fileToDel);
if($do=="1"){
echo "The file was deleted successfully.";
} else { echo "There was an error trying to delete the file."; }
?>
Then it worked !
--was--
I have founda that trying to delete a file using relative path like the example below does not work.
$do = unlink("../pics/$fileToDel");
if($do=="1"){
echo "The file was deleted successfully.";
} else { echo "There was an error trying to delete the file."; }
I did not work at all, instead what I had to do was:
chdir('../pics/');
$do = unlink($fileToDel);
if($do=="1"){
echo "The file was deleted successfully.";
} else { echo "There was an error trying to delete the file."; }
Then it worked !
http://php.net/manual/en/function.delete.php