Why does IMAGETYPE_JPEG not accept all JPEGs?
<p>I am confused about why this code says JPEG files and PNG files are invalid. I want this code to only accept JPEG and PNG, and deny all other file types, but right now, it's denying everything.</p>

<pre><code>&lt;?

echo '
    &lt;form method="post" action="upload.php"&gt;
        &lt;input type="text" placeholder="url" name="url" /&gt; &lt;input type="submit" value="check" name="submit" /&gt;
    &lt;/form&gt;
';

if (isset($_POST["submit"])) {

$url = $_POST["url"];

echo '&lt;strong&gt;URL:&lt;/strong&gt; ' . $url;
echo '&lt;br /&gt;&lt;br /&gt;';

if(!filter_var($url, FILTER_VALIDATE_URL)) { //not valid f-in url
  echo('Invalid url given'); 

} else {
    if (exif_imagetype($url) != IMAGETYPE_JPEG || exif_imagetype($url) != IMAGETYPE_PNG) {
        echo 'Invalid Image&lt;br /&gt;';
    } else {
        echo "Works.";
    }
}

}
?&gt;
</code></pre>
