note 58080 added to function.unlink
| From: | sidepa at ntlworld dot com | Date: | Sun, 23 Oct 2005 19:15:16 +0000 |
| Subject: | note 58080 added to function.unlink | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97469@lists.php.net to get a copy of this message | ||
Sorry about this guys, but I have looked at EVERY page that has come up in search engines regarding
unlink(), but none of them actually explain how the hell you're supposed to use it!
Here's my problem.....
I have a html/php form that uploads files to a directory, and lists the files in that directory in
the form of a hyperlink to the file.
Just before the link to the file, I want a delete button that will delete only that file from the
directory.
What php code do I need to add for the delete function, and what code do I need to add to the a
href="NO-IDEA" for the delete button, to call the delete function?
Code I'm using to list & link the directory contents........
<?PHP
$dir = "download";
$handle = opendir($dir);
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "<a href=\"NO-IDEA\"><img
src=\"images/delete.gif\"></a><a href=\"$dir/$file\"
target=\"_blank\">$file</a><br>";
}
}
closedir($handle);
?>
Code above includes backslashes before quotes in the echo, but for some reason they won't show
in this post!!!
ANY help would be much appreciated. Thanks guys
----
Manual Page -- http://www.php.net/manual/en/function.unlink.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58080
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58080&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58080&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58080&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58080&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58080&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58080&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58080&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58080&report=yes
Search -- http://master.php.net/manage/user-notes.php