FW: mime-type related to extension?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi I sent this on 21st of april and got no answer...
there is no way to check the "real" mime type of a file?
even a file without extension?
thanks,
melanie


From: "mel list_php" <list_php@xxxxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject:  mime-type related to extension?
Date: Thu, 21 Apr 2005 13:45:45 +0000

Hi guys!

I have a basic form to upload files, my problem is about the mime type.
I use $type= $_FILES[$file_uploaded]['type']; to check the mime-type of the fila as I want to allow only .jpeg.
I have then a test like:
if ($type=="image/pjpeg" || $type=="image/jpeg")
{
...
}


Upload working fine if I send "red.jpg".
However if I rename the file in "red", php recognizes it as application/octet-stream and not jpeg.
I'm working under linux and for me the extension is not required for a file, I thought the mime-type was encoded in the file itself and was independent of the extension.
Any clue on that?
Any other php function I should look at?
The cookbook and pear both use $_FILES[ ] ['type'] so I have no idea here.


Thanks,
Melanie

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


_________________________________________________________________
Want to block unwanted pop-ups? Download the free MSN Toolbar now! http://toolbar.msn.co.uk/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux