Notice: getimagesize(): Read error! in


Note: I’m uploading a non-image for testing

Whether this control is a picture or not, Why does it give the following error?

// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
  $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
  if($check !== false) {
    echo "File is an image - " . $check["mime"] . ".";
    $uploadOk = 1;
  } else {
    echo "File is not an image.";
    $uploadOk = 0;

What does print_r($_FILES); show for both cases?

I think I misrepresented

This code is, checks if the file is a picture, no problem here

Must give the following messages

If the file is an image: echo “File is an image”;

If the file is not an image: echo “File is not an image.”;

Why does it give this error? Notice: getimagesize(): Read error! in

Sponsor our Newsletter | Privacy Policy | Terms of Service