note 50331 deleted from features.file-upload by nlopess

From: Date: Fri, 25 Feb 2005 17:54:44 +0000
Subject: note 50331 deleted from features.file-upload by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-85542@lists.php.net to get a copy of this message
Note Submitter: admin at doddnetwork dot co dot uk ---- If like the last user prowebdesign at frontiernet dot net 17-Feb-2005 01:00 You require to filter on mime types why not see in_array; in_array ( mixed needle, array haystack [, bool strict] ) Its pretty simple, build an array of accepted or rejected mime types (which ever is larger), the run the current files mime type through in array with the list IE: <? function check_mime($MIME){ return array('text/html', 'text/plain'); //array of accepted mimes } if(!check_mime($_FILES['uploadfile']['type'])){die;} //if files mime type is not accepted it stops obviosly chage this... ?> Pretty simple and reduces the coding with switches etc... Hope it helps

« previous php.notes (#85542) next »