Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 671487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:22:45+00:00 2026-05-14T00:22:45+00:00

This is not a real bug BUT for sure it is not what you

  • 0

This is not a real bug BUT for sure it is not what you would expect.
I have this sample code to upload images:

if($type=="image/jpg" || $type=="image/jpeg" || $type=="image/pjpeg" || $type=="image/tiff" || $type=="image/gif" || $type=="image/png") {
   // make upload
else echo "Incorrect format ...."; 

The problem is that if I modify the extension of an image, let’s say to .jpgq or even .jpg% and I try to upload it, FF and Chrome will say that the file”s type is “application/octet-stream” and normally the condition will be false.

IE, on the other hand, will say that the file’s type is “image/jpeg”, the condition will be true and the file will be uploaded. Of course, any browser trying to read the image later will not be able to do so.

It is not a bug because on msdn.microsoft.com it says that: “If the “suggested” (server-provided) MIME type is unknown (not known and not ambiguous), FindMimeFromData immediately returns this MIME type” and “If the server-provided MIME type is either known or ambiguous, the buffer is scanned in an attempt to verify or obtain a MIME type from the actual content.”

My questions are:

  1. Why does IE / the server knows the real MIME type on upload BUT it will fail to read it from the server?
  2. How can I work around this issue (if the file doesn’t have the right extension, the condition has to be false)? Is it wise to check the extension format (and not the MIME type)?
  3. is any of the above extensions not recomended to use? Should I add others?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:22:45+00:00Added an answer on May 14, 2026 at 12:22 am

    Forget checking the mime type. Use getimagesize() instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry for this not being a real question, but Sometime back i remember seeing
I know this is not a real programming question. But, it relates to programming
my application is running fine in simulator...but not on real device....and i have jailbroken
Note: this is not real information: $ ssh-keygen -t rsa -C "tekkub@gmail.com" Generating public/private
If this is not a real question then feel free to close ;)
Update: This issue was not properly explored. The real issue lies within render :json
I have this really weird bug. When I scroll down my table view, down
Updates: I have submitted the bug to Adobe and referenced this SO question In
I ask this not to start anything negative. Rather, after looking at ASP.NET MVC
why is this not ok? aContract = function(){}; aContract.prototype = { someFunction: function() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.