I upload images to the server. Before sending, I do a check on the image type.

Recently noticed that some images are not uploaded.

$filenametmp[$count] = $_FILES["img".$i]["tmp_name"]; $imageinfo = getimagesize($filenametmp[$count]); if($imageinfo['mime'] != 'image/gif' && $imageinfo['mime'] != 'image/jpg' && $imageinfo['mime'] != 'image/png' && $imageinfo['mime'] != 'image/jpeg'&& $imageinfo['mime'] != 'image/JPG' ) { echo "Данный тип файла фотографий не поддерживается. Вернитесь назад и выберите фотографию с другим разрешением .jpeg, .gif или .png \n"; exit; } 

Picture SDC10491.JPG

  • s / resolution / extension / - zb '17
  • Well, print $ imageinfo ['mime'] when it’s not successful, but the condition is better to do so: if (! in_array ($ imageinfo ['mime'], array ('image / gif', 'image / jpeg', 'image / png' ) - zb '17
  • Emptiness. $ Imageinfo ['mime'] does not display anything. - Radik Kamalov
  • check the var_dump($_FILES); file var_dump($_FILES); and also see how much your server max. file size allows you to upload. - Smash


0