note 70900 deleted from features.file-upload by nlopess

From: Date: Fri, 03 Nov 2006 14:22:22 +0000
Subject: note 70900 deleted from features.file-upload by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-119339@lists.php.net to get a copy of this message
Note Submitter: kgrimm at lafcs dot cnyric dot org ---- 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; }

« previous php.notes (#119339) next »