Exifimagetype() returns read error Notice, just want it to return false

hi i have the same problem and for solving it i have passed many time of curse waste time because i didnt find the solution and exifimagetype has the same problem please help me:unhappy:

What code have you tried so far?

1 Like

of course any code which i could search in net and the code which is said here but it seems it is impossible
for me to can work with getimagesize function or exif_imagetype when i choose a file which is php and i change the extension to jpg ofcourse my codes say me this isnt an image but again show that error
i really need you advise help me

You generally don’t need getimagesize if you can get the mime content type of a file. When you can determine that the file is an image, you don’t need getimagesize anymore.

@ralphm @guido2004 @TechnoBear @DaveMaxwell @SamA74

Please split this from the original topic as this is topic is 2 years old and would be much more helpful if @jigaralizadeh25 has a new thread to respond to.

1 Like

i’m sorry i could not understand very well
you mean it’s not necessary checking fake or real image
while i myself know that i’m using fake img deliberately :weary:

mime type is what you are looking for and might be what you are referring to. getimagesize only refers to images and may have different results if you are trying to widen the allowed mime types. Say you want to allow both images and zip files, getimagesize will fail for zip files because getimagesize will return false on the zip file. Most users use getimagesize only for image, but when they want to widen the allowed mime types, it’ll take much more effort to modify it to allow zip files. But if you just use the mime type right away, when you only want to allow images, you can simply remove all mime types from an array that doesn’t have the mime type of an image. Or you can add certain mime types to it if you wanted to. This makes it less of a hassle to work around just only allowed image types.


thank you very very much for your answering i don’t know how i can really appreciate
and could you introduce me a site tutorial about mime ?:+1::heartbeat:
i’m beginner in learning php

The best place to learn is the PHP manual.


thanks alot

i want ask a question which is not related to this part but i force to i have read for security i can rename my file but after that i rename my file my codes cant recognize this pic exists before an again upload it what should i do

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.