note 91787 rejected from function.unlink by thiago
| From: | thiago@php.net | Date: | Thu, 25 Jun 2009 12:13:49 +0000 |
| Subject: | note 91787 rejected from function.unlink by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157474@lists.php.net to get a copy of this message | ||
Note Submitter: markandrewperry at hotmail dot co dot uk
----
I am having trouble using the unlink() function. I have a file name posted from a form, i get this
filename and then need to delete the file but the unlink function isn't working correctly, the
code is below.
<?php
$fullname = $_POST['fullname'];
chdir('../portfolio_full');
unlink($fullname);
?>
The filename is held in $fullname and this is what i need to delete, but it only seems to work when
i hard code the file name e.g. <?php unlink('image.jpg'); ?>
does anybody know why this would happen?I have tried setting file and directory permissions and
changing the working directory but none of them worked. any help is greatly appreciated :)