Re: mime-type related to extension?
| From: | Mark Cain | Date: | Wed, 27 Apr 2005 12:15:42 +0000 |
| Subject: | Re: mime-type related to extension? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-39289@lists.php.net to get a copy of this message | ||
The beginning of the jpeg file in hex looks like this:
FF D8 FF
perhaps you could test for that occurrence. Be aware that the occurrence of
FF D8 FF must be in each jpg file -- it does not mean that the occurrence of
FF D8 FF is found only in a jpg file.
http://filext.com/detaillist.php?extdetail=JPG
you could also try http://www.jpeg.org/index.html
Mark Cain
----- Original Message -----
From: "mel list_php" <list_php@hotmail.co.uk>
To: <php-db@lists.php.net>
Sent: Wednesday, April 27, 2005 4:03 AM
Subject: FW: [PHP-DB] mime-type related to extension?
> 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/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>