note 90335 added to function.move-uploaded-file
| From: | sologhost1 at verizon dot net | Date: | Thu, 16 Apr 2009 20:25:21 +0000 |
| Subject: | note 90335 added to function.move-uploaded-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-153405@lists.php.net to get a copy of this message | ||
If you want to get allowed types for an upload, this is much easier and less code than all of the
others:
// Getting images...
$sizes = @getimagesize($_FILES['picture']['tmp_name']);
// Define the allowed file types...
$allowed_types = array(
'1' => 'gif',
'2' => 'jpeg',
'3' => 'png',
'6' => 'bmp',
'15' => 'wbmp'
);
// If we are not the right file type exit
if (!in_array($allowed_types[$sizes[2]], $allowed_types))
fatal_error('Invalid Image Format detected',false);
----
Server IP: 69.147.83.197
Probable Submitter: 71.162.224.7
----
Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php
Edit -- https://master.php.net/note/edit/90335
Del: integrated -- https://master.php.net/note/delete/90335/integrated
Del: useless -- https://master.php.net/note/delete/90335/useless
Del: bad code -- https://master.php.net/note/delete/90335/bad+code
Del: spam -- https://master.php.net/note/delete/90335/spam
Del: non-english -- https://master.php.net/note/delete/90335/non-english
Del: in docs -- https://master.php.net/note/delete/90335/in+docs
Del: other reasons-- https://master.php.net/note/delete/90335
Reject -- https://master.php.net/note/reject/90335
Search -- https://master.php.net/manage/user-notes.php