Re: Re: how to detect type of image

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

 



Jonathan wrote:
Alain Roger wrote:
Hi,

In my web application, end user is able to load images (png, jpeg, gif,..)
into database.
I would like to know how can i detect automatically the type of image (pnd,
jpeg,...) ?
i do not want to check the extension because this is easily faked... just by
renaming it.

Does it exist a technique for that ?

thanks a lot,


Is there anything wrong with just using $_FILES['upload_name']['type']?


$_FILES['upload_name']['type'] appears to believe the extension. Try it--upload a file with a misleading extension.

This same question was asked yesterday and the advice was to use
    string *mime_content_type* ( string filename)
That doesn't seem to get fooled very easily, though I suppose you could fool it if you went to the effort of, say, setting up a fake image header, when what you are sending is a time bomb.

M.


--

_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

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