简体   繁体   中英

Uploading image mime-type application/jpg

We have a few pcs in the office and while testing a websites image uploading in one of them the mime-type detected was "application/jpg" or "application/png" while it should be "image/jpg" and "image/png". The browsers that did this were Internet explorer v11.0 and Edge v40. The versions were same on other pc but the mime-types were ok (image/ ). Where is it getting the idea that image mime-type is application/ ??

The upload element is nothing special (it is triggered by an outside button):

<input style="display:none" id="upload_damage_image" type="file" name="file[0]">

We had this issue recently, the cause was Autodesk Pixlr it had overwritten the String value Content Type from "image/jpeg" to "application/jpeg" in registry HKLM\\SOFTWARE\\Classes.jpg.

Uninstalled Autodesk Pixlr but it actually deleted the Content Type values rather than restoring to image/*.

Used Regshot to compare registry before and after installation of Autodesk Pixlr. Identified the changed entries below:

HKLM\\SOFTWARE\\Classes.bmp\\Content Type: "application/bmp" HKLM\\SOFTWARE\\Classes.gif\\Content Type: "application/gif" HKLM\\SOFTWARE\\Classes.jpeg\\Content Type: "application/jpeg" HKLM\\SOFTWARE\\Classes.jpg\\Content Type: "application/jpg" HKLM\\SOFTWARE\\Classes.png\\Content Type: "application/png" HKLM\\SOFTWARE\\Classes.tif\\Content Type: "application/tif" HKLM\\SOFTWARE\\Classes.tiff\\Content Type: "application/tiff"

So uninstalled it again, backed up registry and created the correct entries below:

HKLM\\SOFTWARE\\Classes.bmp\\Content Type: "image/bmp" HKLM\\SOFTWARE\\Classes.gif\\Content Type: "image/gif" HKLM\\SOFTWARE\\Classes.jpeg\\Content Type: "image/jpeg" HKLM\\SOFTWARE\\Classes.jpg\\Content Type: "image/jpeg" HKLM\\SOFTWARE\\Classes.png\\Content Type: "image/png" HKLM\\SOFTWARE\\Classes.tif\\Content Type: "image/tiff"
HKLM\\SOFTWARE\\Classes.tiff\\Content Type: "image/tiff"

This resolved the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM