NYCPHP Meetup

NYPHP.org

[nycphp-talk] Using $_FILES["whatever"]["type"] correctly

Eric Persson eric at persson.tm
Wed Jan 14 08:28:36 EST 2004


Webapprentice . wrote:
> 			$imageType = $_FILES["frontimage"]["type"];


Using the type thats in $_FILES is generally a bad idea, since its set 
by the browser, and different browsers set different types for the same 
file. I usually use the *nix program file program to determine the 
filetype, then you know that it will always return the same typ for the 
same type of files.

Something like
file -ib <filename>
gives the type on the last line.

Just my idea. :)

//Eric
--
Help Webaid.se help the world.
http://www.webaid.se



More information about the talk mailing list