note 87223 deleted from reserved.variables.files by danbrown

From: Date: Tue, 25 Nov 2008 15:54:22 +0000
Subject: note 87223 deleted from reserved.variables.files by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-146926@lists.php.net to get a copy of this message
Note Submitter: admin at studio-gepard dot pl ---- Structure of $_FILES: Array ( [file] => Array ( [name] => [type] => [tmp_name] => [error] => [size] => ) ) name will contain name of file uploaded type - filetype like application/x-shockwave-flash or image/png (it's file mime type I guess) tmp_name - path to file in temp directory error - 0=no error 1=error size - file size in bytes. How to check if the file is of given type? (here: check if it's .swf or .jpg) Create array and check if $_FILES contains given type. $types = array('application/x-shockwave-flash','image/jpeg'); $file = $_FILES['file']['type']; if (!in_array($file,$types))

« previous php.notes (#146926) next »