Re: mime type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, November 21, 2006 2:22 am, Fernando Viadero wrote:
> is this code OK???

No!

> "fotos" is an array of uploaded files (images)..
>
>       $tipo = $HTTP_POST_FILES["fotos"]["type"][$a];

The mime type sent by the browser is COMPLETELY unreliable and
unpredictable.

Evil people will send "image/png" for a nasty virus, for example.

Plus, IE will send some bogus made-up mime type whenever they feel
like it, while real browsers will attempt, and sometimes fail, to
guess the correct mime type to send for any given image.

You would be better off to use http://php.net/getimagesize on the file
to find out what is inside of it, at least for the first N bytes,
which is what the file is *claiming* to be.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux