NYCPHP Meetup

NYPHP.org

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

Adam Maccabee Trachtenberg adam at trachtenberg.com
Wed Jan 14 11:27:26 EST 2004


On Wed, 14 Jan 2004, Eric Persson wrote:

> 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.

Even better, use the mime-magic extension:

http://www.php.net/mime-magic

-adam

-- 
adam at trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!



More information about the talk mailing list