What's wrong with my If-statement to check uploaded file? (PHP)
- by ggfan
I am trying to test if the uploaded file is the image type I want. If it isn't a gif,jpeg, png, it should echo "Problem". But when I execute this code, it always says there's a problem. What's wrong with my if statement?
$uploadfile_type=$_FILES['userfile']['type'];
    if ( ($uploadfile_type !='image/gif') || ($uploadfile_type !='image/jpeg') 
    || ($uploadfile_type !='image/png'))  
    {
        echo 'Problem: file is not a gif or jpeg or png!';
        exit;
    }
This code works when I am only checking one type of image. Ex: if($uploadfile_type !='image/gif') -- this statement would work but when I add a OR it doesn't.