简单如果/不工作......不确定为什么。(应该是愚蠢的容易)

Ok so i have this image uploading thing im trying to add on this small app im trying to make...i stress trying lol(for my studies), and simply in this section, im trying to check for file type with a simple if/else.

i cut out the code to the part thats giving me problems.

so the html is this:

<form method="post" action="testUpload.php" enctype="multipart/form-data">
<table summary="practice" width="500">
        <tr>
            <td>load picture:</td>
            <td><input type="file" name="screenshot" id="screenshot" ></td>
        </tr>
        <tr>
            <td><input type="submit" name="submit" action="submit"></td>
        </tr>
</table>


</form>

the php is this:

$screenshot = $_FILES['screenshot']['name'];
$picSize = $_FILES['screenshot']['size'];
$picType = $_FILES['screenshot']['type'];

if($screenshot && $picSize && $picType){
    if($picType == 'image/jpg' || $picType == 'image/pjpeg'){
            echo ' your pic type is jpg <br/>';
    } else {
        echo ' this pic type is not supported <br/>';
    }
}

when i run this, it always gives me the " this pic type is not supported."

the image im testing with is the correct size, type etc so not sure why its not giving me the first option.

when i test for size like so:

if ($picSize <9000){
        echo ' your pic size is within limits. <br/>';
    } else {
        echo ' pic is too big ';    
    }

it works so....i don't understand.

any ideas/suggestions etc. ill gladly accept.

thank you.

any ideas

Because you have compared to the wrong mime type,
standard mime type for JPEG is image/jpeg,
which does not exist in your comparison clause

Echo your pic type in the error, just to be sure what you are working with.

if($screenshot && $picSize && $picType){
    if($picType == 'image/jpg' || $picType == 'image/pjpeg'){
        echo ' your pic type is jpg <br/>';
    } else {
        echo ' this pic type is not supported (' . $picType . ')<br/>';
    }
}