note 75275 added to function.finfo-file
| From: | SchraalhansKeukenmeester at osu1 dot php dot net | Date: | Mon, 21 May 2007 22:20:48 +0000 |
| Subject: | note 75275 added to function.finfo-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126807@lists.php.net to get a copy of this message | ||
Tempting as it may seem to use finfo_file() to validate uploaded image files (Check whether a
supposed imagefile really contains an image), the results cannot be trusted. It's not that hard
to wrap harmful executable code in a file identified as a GIF for instance.
A better & safer option is to check the result of:
if (!$img = @imagecreatefromgif($uploadedfilename)) {
trigger_error('Not a GIF image!',E_USER_WARNING);
// do necessary stuff
}
----
Server IP: 194.109.193.76
Probable Submitter: 88.211.177.163
----
Manual Page -- http://www.php.net/manual/en/function.finfo-file.php
Edit -- https://master.php.net/note/edit/75275
Del: integrated -- https://master.php.net/note/delete/75275/integrated
Del: useless -- https://master.php.net/note/delete/75275/useless
Del: bad code -- https://master.php.net/note/delete/75275/bad+code
Del: spam -- https://master.php.net/note/delete/75275/spam
Del: non-english -- https://master.php.net/note/delete/75275/non-english
Del: in docs -- https://master.php.net/note/delete/75275/in+docs
Del: other reasons-- https://master.php.net/note/delete/75275
Reject -- https://master.php.net/note/reject/75275
Search -- https://master.php.net/manage/user-notes.php