FW: [PHP-DB] mime-type related to extension?
| From: | mel list_php | Date: | Wed, 27 Apr 2005 08:03:12 +0000 |
| Subject: | FW: [PHP-DB] mime-type related to extension? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-39288@lists.php.net to get a copy of this message | ||
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@hotmail.co.uk> To: php-db@lists.php.net Subject: [PHP-DB] 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/