i'm working on a script to allow user to upload files, i only want to allow zip and rar file type.. which appears my error checking works for that.. but when the file size is greater than 1MB (1048576 bytes) it doesn't show the max file size error but rather the file type error... seems a bit weird.
$filename = 'sskin_'.time() . '_' . $_FILES['userfile']['name'];
$uploadfile = $_SERVER['DOCUMENT_ROOT'] . '/site/pending/' . $filename;
if($_FILES['userfile']['type'] != 'application/x-zip-compressed' || $_FILES['userfile']['type'] != 'application/x-rar-compressed')
{
echo '<b>File must be in zip or rar format.</b>';
$is_error = true;
}
else
{
if($_FILES['userfile']['size'] > '1048576') // 1mb limit
{
echo '<b>File is too large!</b><br />The file you are trying to upload is ' .
number_format($_FILES['userfile']['size'] / 1024, 1, '', '') . " KB's <br />Maximum allowed size is 1 Megabyte";
$is_error = true;
}
else
{
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{
eval("echo(\"" . template("steamskin_submitted") . "\");");
}
else
{
echo 'Skin was not uploaded .. Please try agin.';
$is_error = true;
}
}
}
// few more $is_error checks..