note 81096 added to function.delete
| From: | RisingKing at osu1 dot php dot net | Date: | Thu, 14 Feb 2008 00:41:15 +0000 |
| Subject: | note 81096 added to function.delete | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136132@lists.php.net to get a copy of this message | ||
<?
$filename=stripslashes($_GET['file']);
if(file_exists("$filename"))
{
if(unlink("$filename"))
{
echo "File was successfully deleted";
}
else
{
echo "File was not deleted.";
}
}
else
{
echo "File does not exist.";
}
?>
This checks if the file exists, if the file exists it deletes the file and returns a message
confirming the deletion. If the file was not deleted, a message will be returned say the file was
not deleted. If the file does not exist, a message will be returned say the file doesn't exist.
To use the script just add at the end of the URL ?file={the file you want to delete}
Ex:
127.0.0.1/delete.php?file=New Text Document.txt
That will delete the file New Text Document.txt
----
Server IP: 64.71.164.2
Probable Submitter: 162.84.18.178
----
Manual Page -- http://www.php.net/manual/en/function.delete.php
Edit -- https://master.php.net/note/edit/81096
Del: integrated -- https://master.php.net/note/delete/81096/integrated
Del: useless -- https://master.php.net/note/delete/81096/useless
Del: bad code -- https://master.php.net/note/delete/81096/bad+code
Del: spam -- https://master.php.net/note/delete/81096/spam
Del: non-english -- https://master.php.net/note/delete/81096/non-english
Del: in docs -- https://master.php.net/note/delete/81096/in+docs
Del: other reasons-- https://master.php.net/note/delete/81096
Reject -- https://master.php.net/note/reject/81096
Search -- https://master.php.net/manage/user-notes.php