note 90335 deleted from function.move-uploaded-file by danbrown
| From: | danbrown@php.net | Date: | Thu, 16 Apr 2009 20:29:00 +0000 |
| Subject: | note 90335 deleted from function.move-uploaded-file by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153406@lists.php.net to get a copy of this message | ||
Note Submitter: sologhost1 at verizon dot net
----
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);