php uploads are not allowed anymore - will abort upload

This commit is contained in:
alopexc0de 2012-10-09 04:04:04 -04:00
parent 67bf8e2a7a
commit 15277d0f12

View File

@ -31,18 +31,24 @@ if (($_FILES["file"]["size"] < 2000000))
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
//echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists("upload/" . $_FILES["file"]["name"])) if (file_exists("upload/" . $_FILES["file"]["name"]))
{ {
echo $_FILES["file"]["name"] . " already exists. "; echo $_FILES["file"]["name"] . " already exists. ";
} }
else else
{ {
if($_FILES["file"]["type"] == "application/x-php"){
echo $_FILES["file"]["name"] . " is not allowed, sorry about that...";
}else{
move_uploaded_file($_FILES["file"]["tmp_name"], move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]); "upload/" . $_FILES["file"]["name"]);
echo "Stored at: <a href='http://unps-gama.tk/upload/".$_FILES["file"]["name"]."'>". $_FILES["file"]["name"]."</a>"; echo "Stored at: <a href='http://unps-gama.tk/upload/".$_FILES["file"]["name"]."'>". $_FILES["file"]["name"]."</a>";
} }
} }
} }
}
else else
{ {
echo "Invalid file"; echo "Invalid file";