Can anyone help me out.
I'm having a few problems with an upload script I've tried to write.
Basically I want to only allow users to upload gif/jpg with a file size less than 120KB.
I've written the following bit of validation but it seems to work in the opposite way to I would expect. Does anyone have any ideas??
$_FILE looks like this:
Array ( [userfile] => Array ( [name] => latenight.jpg [type] => image/pjpeg [tmp_name] => /tmp/phpxsJn7R [error] => 0 [size] => 33796 ) )
The code I am using is this:
if(($userfile_type != "image/gif") || ($userfile_type != "image/pjpeg") || ($userfile_size > 122880)){
echo 'ERROR: The file could not be uploaded. This could be because:<br/>';
echo '- The file was an incorrect filetype, please supply the image in either GIF or JPEG formats.<br/>';
echo '- The file was larger than 120KB.<br/>';
} else {
echo 'Upload';
}