Eish.... The easiest way is use
$file_info = getimagesize($_FILES['image']['tmp_name']);
if(empty($file_info)) {
$error_msg = "The uploaded file doesn't seem to be an image.";
$upload_error = 1;
}
Only an image file will return a true value.
Or if you really want to go all out make files only down loadable so that when someone hotlinks to your file he/she will not be able to run the file but not download it. It is a bit tricky but I am willing to help if needed.
$file_info = getimagesize($_FILES['image']['tmp_name']);
if(empty($file_info)) {
$error_msg = "The uploaded file doesn't seem to be an image.";
$upload_error = 1;
}
Only an image file will return a true value.
Or if you really want to go all out make files only down loadable so that when someone hotlinks to your file he/she will not be able to run the file but not download it. It is a bit tricky but I am willing to help if needed.
Comment