Reputation: 13
I have a php project where I have to pass file name as POST request to delete files in web server.But while I pass file name containing # ( Number Sign ) it is unable to get correct file name which resulting error.
here is my simple php script
<?php
$file = $_GET["file"];
if (!unlink("upload/".$file))
{
echo ("Error deleting $file");
}
else
{
echo ("Deleted $file");
}
?>
Upvotes: 1
Views: 123
Reputation: 943650
Because:
$_GET
not $_POST
and#
has special meaning in URIs and must be percent encoded as %23
if you want to express it as dataUpvotes: 5