mime-type related to extension?

From: Date: Thu, 21 Apr 2005 13:45:45 +0000
Subject: mime-type related to extension?
Groups: php.db 
Request: Send a blank email to php-db+get-39251@lists.php.net to get a copy of this message
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

« previous php.db (#39251) next »