• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 23:33
CET 05:33
KST 13:33
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
[BSL21] Ro.16 Group Stage (C->B->A->D)1Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win2RSL Season 3: RO16 results & RO8 bracket13Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge2[TLMC] Fall/Winter 2025 Ladder Map Rotation14
StarCraft 2
General
When will we find out if there are more tournament Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win SC: Evo Complete - Ranked Ladder OPEN ALPHA Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge RSL Season 3: RO16 results & RO8 bracket
Tourneys
Tenacious Turtle Tussle RSL Revival: Season 3 $5,000+ WardiTV 2025 Championship StarCraft Evolution League (SC Evo Biweekly) Constellation Cup - Main Event - Stellar Fest
Strategy
Ride the Waves in Surf City: Why Surfing Lessons H
Custom Maps
Map Editor closed ?
External Content
Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death
Brood War
General
Which season is the best in ASL? FlaSh on: Biggest Problem With SnOw's Playstyle soO on: FanTaSy's Potential Return to StarCraft Data analysis on 70 million replays 2v2 maps which are SC2 style with teams together?
Tourneys
[BSL21] RO16 Tie Breaker - Group B - Sun 21:00 CET [BSL21] GosuLeague T1 Ro16 - Tue & Thu 22:00 CET [Megathread] Daily Proleagues [BSL21] RO16 Tie Breaker - Group A - Sat 21:00 CET
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread Should offensive tower rushing be viable in RTS games? Nintendo Switch Thread Path of Exile Clair Obscur - Expedition 33
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine YouTube Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
The Health Impact of Joining…
TrAiDoS
Dyadica Evangelium — Chapt…
Hildegard
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2501 users

IE and MIME types

Blogs > Huanir
Post a Reply
Huanir
Profile Blog Joined May 2009
United States85 Posts
March 19 2010 19:18 GMT
#1
So apparently, Internet Explorer reports .jpg files as image/pjpeg instead of image/jpeg like everyone else does. Even the IETF RFCs use image/jpeg in their examples!

As one of the developers on a image-hosting site for a class project, I find this annoying. Why would Microsoft do this, and does anyone know what else they've changed?

*
Lord of the Rings was the greatest work of literature of the twentieth century, period. ~Orson Scott Card
love1another
Profile Blog Joined December 2009
United States1844 Posts
Last Edited: 2010-03-19 19:43:58
March 19 2010 19:41 GMT
#2
That's really strange. I'll see if I can find anything about this.

Edit: Check http://msdn.microsoft.com/en-us/library/ms775147(VS.85).aspx
"I'm learning more and more that TL isn't the place to go for advice outside of anything you need in college. It's like you guys just make up your own fantasy world shit and post it as if you've done it." - Chill
538
Profile Blog Joined November 2008
Hungary3932 Posts
March 19 2010 19:43 GMT
#3
lol, are you looking for a comprehensive list of things in which IE does not follow the general practice or the industry standards? Good luck with that

Seriously though, you must be really quite new to web-development i presume.
BW fighting!
love1another
Profile Blog Joined December 2009
United States1844 Posts
Last Edited: 2010-03-19 19:46:00
March 19 2010 19:45 GMT
#4
I think OP is referring only to different MIME handling. If you give a use case of where this is causing a problem, I can probably of be more help by suggesting certain workarounds.
"I'm learning more and more that TL isn't the place to go for advice outside of anything you need in college. It's like you guys just make up your own fantasy world shit and post it as if you've done it." - Chill
R1CH
Profile Blog Joined May 2007
Netherlands10341 Posts
March 19 2010 19:59 GMT
#5
How does Internet Explorer "report" a mime type anyway? It's up to the web server to send the appropriate Content-type to the browser.
AdministratorTwitter: @R1CH_TL
TL+ Member
Aerox
Profile Blog Joined September 2004
Malaysia1213 Posts
Last Edited: 2010-03-19 20:30:04
March 19 2010 20:26 GMT
#6
On March 20 2010 04:59 R1CH wrote:
How does Internet Explorer "report" a mime type anyway? It's up to the web server to send the appropriate Content-type to the browser.

From the love1another's link:
The purpose of MIME type detection, or data sniffing, is to determine the MIME type (also known as content type or media type) of downloaded content using information from the following four sources:

-The server-supplied MIME type, if available
-An examination of the actual contents associated with a downloaded URL
-The file name associated with the downloaded content (assumed to be derived from the associated URL)
-Registry settings (file extension/MIME type associations or registered applications) in effect during the download


As for OP, I guess he just wanted a reason for IE not being standard... from same link:
In some cases, the detected MIME type can differ from the generally accepted value for backwards compatibility, as shown in the following table:

Standard MIME Type......... FindMimeFromData Returns
image/jpeg........ image/pjpeg
image/png.........image/x-png

Yeah, Netscape and IE were fucking around and trying to set their own standards and stuff back in the older days.

edit: Oh, OP asked "what else?". Uh, too much. LOL. Shouldn't be hard to google. I don't know if someone compiled a unified list yet but there should be mini lists like differences with CSS or HTML tags.... etc.
"Eyes in the sky."
R1CH
Profile Blog Joined May 2007
Netherlands10341 Posts
March 19 2010 20:35 GMT
#7
I'm just wondering in what situation you would ever have it be an issue since a server-provided mime-type is issued in almost every circumstance. I'm guessing this has to do with opening files locally rather than from a web server?
AdministratorTwitter: @R1CH_TL
TL+ Member
love1another
Profile Blog Joined December 2009
United States1844 Posts
Last Edited: 2010-03-19 20:43:20
March 19 2010 20:39 GMT
#8
On March 20 2010 04:59 R1CH wrote:
How does Internet Explorer "report" a mime type anyway? It's up to the web server to send the appropriate Content-type to the browser.

But the web server generally doesn't give specifics. Octet stream, for example, is all a non-customized file transfer will say. It's up to the client, often, to determine what to do with the downloaded file. It usually figures this out based on the file extension.

On March 20 2010 05:35 R1CH wrote:
I'm just wondering in what situation you would ever have it be an issue since a server-provided mime-type is issued in almost every circumstance. I'm guessing this has to do with opening files locally rather than from a web server?


I requested a use case, because I had the same question... generally the server and client can decide the MIME type independently, so from the server's perspective, you don't really give a shit if Internet Explorer says the jpeg is a pjpeg. Likewise, if a client uploads a "pjpeg" type, the server generally uses its own algorithm for determining what the file is anyway. And I just realized your icon is MTG.
"I'm learning more and more that TL isn't the place to go for advice outside of anything you need in college. It's like you guys just make up your own fantasy world shit and post it as if you've done it." - Chill
Huanir
Profile Blog Joined May 2009
United States85 Posts
March 19 2010 20:44 GMT
#9
On March 20 2010 05:35 R1CH wrote:
I'm just wondering in what situation you would ever have it be an issue since a server-provided mime-type is issued in almost every circumstance. I'm guessing this has to do with opening files locally rather than from a web server?


Yeah, I want to restrict the types of files a user can upload, probably to jpegs, pngs, and gifs.
Lord of the Rings was the greatest work of literature of the twentieth century, period. ~Orson Scott Card
Huanir
Profile Blog Joined May 2009
United States85 Posts
March 19 2010 20:45 GMT
#10
On March 20 2010 04:45 love1another wrote:
I think OP is referring only to different MIME handling. If you give a use case of where this is causing a problem, I can probably of be more help by suggesting certain workarounds.


In the following code, uploading a jpeg in IE would follow the "Invalid file" path.

<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg"))
&& ($_FILES["file"]["size"] < 20000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
}
else
{
echo "Invalid file";
}
?>
Lord of the Rings was the greatest work of literature of the twentieth century, period. ~Orson Scott Card
Huanir
Profile Blog Joined May 2009
United States85 Posts
March 19 2010 20:46 GMT
#11
And I know that checking for "image/pjpeg" would easily solve the issue, but I think this is an ugly workaround, considering that it's supposed to be standard.

XD @ Microsoft
Lord of the Rings was the greatest work of literature of the twentieth century, period. ~Orson Scott Card
love1another
Profile Blog Joined December 2009
United States1844 Posts
Last Edited: 2010-03-19 20:50:22
March 19 2010 20:47 GMT
#12
On March 20 2010 05:44 Huanir wrote:
Show nested quote +
On March 20 2010 05:35 R1CH wrote:
I'm just wondering in what situation you would ever have it be an issue since a server-provided mime-type is issued in almost every circumstance. I'm guessing this has to do with opening files locally rather than from a web server?


Yeah, I want to restrict the types of files a user can upload, probably to jpegs, pngs, and gifs.


Try reading this for an explanation of how it's done. http://www.bitrepository.com/how-to-validate-an-image-upload.html

Alternatively, check http://www.php.net/manual/en/function.getimagesize.php

There should be comparable functions for whatever language you're using.

If that stuff is TL;DR, then the key thing is don't trust what the client tells you. Figure the file type out yourself based on what's uploaded. Otherwise, what if I had a malicious client that sent you a malicious php script while telling you "lol, I'm a jpg let me through." I don't know if your configuration will be stupid enough to let this happen in practice, but it's still a bad idea.

Edit: And try not to triple post.
"I'm learning more and more that TL isn't the place to go for advice outside of anything you need in college. It's like you guys just make up your own fantasy world shit and post it as if you've done it." - Chill
Huanir
Profile Blog Joined May 2009
United States85 Posts
March 19 2010 20:57 GMT
#13
On March 20 2010 05:47 love1another wrote:
Show nested quote +
On March 20 2010 05:44 Huanir wrote:
On March 20 2010 05:35 R1CH wrote:
I'm just wondering in what situation you would ever have it be an issue since a server-provided mime-type is issued in almost every circumstance. I'm guessing this has to do with opening files locally rather than from a web server?


Yeah, I want to restrict the types of files a user can upload, probably to jpegs, pngs, and gifs.


Try reading this for an explanation of how it's done. http://www.bitrepository.com/how-to-validate-an-image-upload.html

Alternatively, check http://www.php.net/manual/en/function.getimagesize.php

There should be comparable functions for whatever language you're using.

If that stuff is TL;DR, then the key thing is don't trust what the client tells you. Figure the file type out yourself based on what's uploaded. Otherwise, what if I had a malicious client that sent you a malicious php script while telling you "lol, I'm a jpg let me through." I don't know if your configuration will be stupid enough to let this happen in practice, but it's still a bad idea.

Edit: And try not to triple post.


Many thanks; the links were indeed helpful (as was the mentality you suggested). And sorry about the triple-post. I didn't occur to me until after I'd posted them that I should have used Edit. v_v
Lord of the Rings was the greatest work of literature of the twentieth century, period. ~Orson Scott Card
R1CH
Profile Blog Joined May 2007
Netherlands10341 Posts
March 19 2010 21:06 GMT
#14
Oh, you should never trust the mime-type that the browser provides for file uploads. I could easily upload a .exe and claim it was an image/png if that's all you checked.

See http://shsc.info/FileUploadSecurity for more info about how to do this properly.
AdministratorTwitter: @R1CH_TL
TL+ Member
love1another
Profile Blog Joined December 2009
United States1844 Posts
March 19 2010 22:13 GMT
#15
Yay R1CH agrees with me!
"I'm learning more and more that TL isn't the place to go for advice outside of anything you need in college. It's like you guys just make up your own fantasy world shit and post it as if you've done it." - Chill
Please log in or register to reply.
Live Events Refresh
PiGosaur Cup
01:00
#59
SteadfastSC297
CranKy Ducklings147
EnkiAlexander 60
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SteadfastSC 297
RuFF_SC2 163
StarCraft: Brood War
Britney 9435
Artosis 625
Snow 60
Soulkey 58
Noble 44
Sharp 22
Icarus 6
Dota 2
monkeys_forever467
League of Legends
JimRising 790
Counter-Strike
Coldzera 1969
Other Games
summit1g7889
C9.Mang0342
ViBE176
WinterStarcraft132
Trikslyr60
Organizations
Other Games
gamesdonequick1048
Dota 2
PGL Dota 2 - Main Stream266
StarCraft: Brood War
UltimateBattle 10
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• Hupsaiya 77
• Kozan
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• intothetv
• Migwel
• IndyKCrew
StarCraft: Brood War
• Azhi_Dahaki27
• RayReign 9
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Rush1099
• Lourlo514
• Stunt321
Other Games
• Scarra2057
Upcoming Events
Replay Cast
4h 27m
Wardi Open
7h 27m
OSC
8h 27m
Tenacious Turtle Tussle
19h 27m
The PondCast
1d 5h
Replay Cast
1d 18h
OSC
2 days
LAN Event
2 days
Replay Cast
2 days
Replay Cast
3 days
[ Show More ]
WardiTV Korean Royale
3 days
Sparkling Tuna Cup
4 days
WardiTV Korean Royale
4 days
Replay Cast
4 days
Wardi Open
5 days
Monday Night Weeklies
5 days
Replay Cast
5 days
Wardi Open
6 days
Liquipedia Results

Completed

SOOP Univ League 2025
RSL Revival: Season 3
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
META Madness #9
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.