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.
<?
echo '
<form method="post" action="upload.php">
<input type="text" placeholder="url" name="url" /> <input type="submit" value="check" name="submit" />
</form>
';
if (isset($_POST["submit"])) {
$url = $_POST["url"];
echo '<strong>URL:</strong> ' . $url;
echo '<br /><br />';
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<br />';
} else {
echo "Works.";
}
}
}
?>