Re: mime type

From: Date: Tue, 21 Nov 2006 17:33:06 +0000
Subject: Re: mime type
Groups: php.general 
Request: Send a blank email to php-general+get-244974@lists.php.net to get a copy of this message
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?

« previous php.general (#244974) next »