file type detection in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

file type detection in php

Post by susrisha »

I have a page which enables the uploading of files..(basically images of format .jpg, .gif and .png). while uploading a png file in internet explorer(IE) i am getting the file type as 'image/x-png' and in other browsers, it only shows the file type as 'image/png'.
can someone tell me why this difference when the same file is uploaded through different browsers??

Code: Select all

 
$type = $_FILES["file"]["type"];
echo $type;
 
 
Response from IE : image/x-png
Response from FireFox: image/png

why is the difference??
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: file type detection in php

Post by onion2k »

susrisha wrote:why is the difference??
Because Microsoft don't stick to standards.
Post Reply