Hello all - been a while since I've posted here, but I've run into an issue that's got me stumped. I'm fairly certain it's a simple solution, but I can't see it. I've written an image upload script that checks to make sure the uploaded file is either is either a jpeg or gif with an

if(($HTTP_POST_FILES['type'] == "image/jpeg") || ($HTTP_POST_FILES['type'] == "image/gif"))

code snippet. This works in Firefox - image uploads correctly - however, it doesn't work in Internet Explorer. I've run a search through this forum on the topic, but didn't come back with any applicable results, so my apologies if this has been asked in a slightly different way before.
But basically, anybody got any ideas on this? Does Internet Explorer send different image headers with .jpgs or .gifs? If so, anywhere on the web I can find the inclusive listing? Unfortunately, I'm not in a situation were I can dictate the user browser, so any way around this would be great.
Thanks in advance for any/all help, advice, pointers to additional references - anything that'll save what hair I haven't ripped out already!

    the MIME type for JPEG's sent by IE is "image/pjpeg" not "image/jpeg".

    perhaps a more reliable way of checking that an uploaded image file is in fact an image file is to run it through [man]getimagesize[/man] which will return FALSE if the supplied argument is not a valid image.

      Thank you! Now I feel like a complete idiot... And thanks for the heads-up on getimagesize() - just ran across that about 10 minutes ago.. Sounds like it's time to do some digging... 😃

      Thanks again!

        Write a Reply...