note 70900 added to features.file-upload
| From: | kgrimm at lafcs dot cnyric dot org | Date: | Fri, 03 Nov 2006 14:20:46 +0000 |
| Subject: | note 70900 added to features.file-upload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119336@lists.php.net to get a copy of this message | ||
To check to make sure that I am only permitting images to upload, I use the following script.
Imagesize[] returns a possible 4 elements, but I only want the second set of options which is a set
of image file types. Hence I request only $imagesize[2]. It is helpful to have a list of all
possible returns and their values so users can build an appropriate set of tests for our individual
needs.
<?php
switch ( $imagesize[2] )
{
case 0:
echo '<BR> Image is unknown <BR>';
break;
case 1:
$file_type = '.gif';
break;
case 2:
$file_type = '.jpg';
break;
case 3:
$file_type = '.png';
break;
case 4:
$file_type = ".swf";
break;
case 5:
$file_type = ".psd";
break;
case 6:
$file_type = ".bmp";
break;
case 7:
$file_type = ".tif";
break;
}
----
Server IP: 66.163.161.117
Probable Submitter: 74.71.70.48
----
Manual Page -- http://www.php.net/manual/en/features.file-upload.php
Edit -- https://master.php.net/note/edit/70900
Del: integrated -- https://master.php.net/note/delete/70900/integrated
Del: useless -- https://master.php.net/note/delete/70900/useless
Del: bad code -- https://master.php.net/note/delete/70900/bad+code
Del: spam -- https://master.php.net/note/delete/70900/spam
Del: non-english -- https://master.php.net/note/delete/70900/non-english
Del: in docs -- https://master.php.net/note/delete/70900/in+docs
Del: other reasons-- https://master.php.net/note/delete/70900
Reject -- https://master.php.net/note/reject/70900
Search -- https://master.php.net/manage/user-notes.php