Ok, so I am creating an uploader for uploading files such as .udk or .upk as well as other basic files such as txt and html. But I have been tinkering with the code I found (i'm a noob) and I can't get it to accept those extra extensions.
Here is my code:
<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "udk")
|| ($_FILES["file"]["type"] == "upk")
|| ($_FILES["file"]["type"] == "application/exe")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/bmp")
|| ($_FILES["file"]["type"] == "image/jpeg")
&& ($_FILES["file"]["size"] < 20000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists("dropbox/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. Please rename and try again.";
}
else
{
$yes = "<a href='/dropbox/" . $_FILES["file"]["name"] . "'>Confirm</a>";
move_uploaded_file($_FILES["file"]["tmp_name"],
"dropbox/" . $_FILES["file"]["name"]);
echo $yes;
}
}
}
else
{
if (($_FILES["file"]["size"] < 20000)){
echo "Your file is too big!";
}
else{
echo "Invalid file";
}
}
?>