note 50331 added to features.file-upload

From: Date: Thu, 24 Feb 2005 22:29:59 +0000
Subject: note 50331 added to features.file-upload
Groups: php.notes 
Request: Send a blank email to php-notes+get-85496@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/features.file-upload.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50331 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50331&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50331&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50331&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50331&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50331&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50331&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#85496) next »