For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > January 2006 > Re: How reliable is mime type in $_FILES superglobal.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: How reliable is mime type in $_FILES superglobal.
d

2006-01-31, 7:55 am

"NC" <nc@iname.com> wrote in message
news:1138657877.599655.215680@g47g2000cwa.googlegroups.com...
> splodge wrote:
>
> It depends on your definition of "right"... If I understand correctly,
> MIME type is determined based on the file's extension.


Nope - PHP uses the MIME Magic library to determine the mime type of a file
based on the position of key bytes within the file:

http://uk2.php.net/mime_magic

So you could call an .exe .txt, and it would be picked up as an executable.

> Cheers,
> NC
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com