You can validate image in php, this way: <?php $img = "banner.gif"; // an image $info = getimagesize($img); print image_type_to_mime_type($info[2]); ?> The outout will generally be: image/jpeg or image/gif or image/png But if it is: application/octet-stream, then the file is not an image.