note 89674 added to reserved.variables.files

From: Date: Wed, 18 Mar 2009 18:35:46 +0000
Subject: note 89674 added to reserved.variables.files
Groups: php.notes 
Request: Send a blank email to php-notes+get-152109@lists.php.net to get a copy of this message
The format of this array is (assuming your form has two input type=file fields named "file1", "file2", etc): Array ( [file1] => Array ( [name] => MyFile.txt (comes from the browser, so treat as tainted) [type] => text/plain (not sure where it gets this from - assume the browser, so treat as tainted) [tmp_name] => /tmp/php/php1h4j1o (could be anywhere on your system, depending on your config settings, but the user has no control, so this isn't tainted) [error] => UPLOAD_ERR_OK (= 0) [size] => 123 (the size in bytes) ) [file2] => Array ( [name] => MyFile.jpg [type] => image/jpeg [tmp_name] => /tmp/php/php6hst32 [error] => UPLOAD_ERR_OK [size] => 98174 ) ) Last I checked (a while ago now admittedly), if you use array parameters in your forms (that is, form names ending in square brackets, like several file fields called "download[file1]", "download[file2]" etc), then the array format becomes... interesting. Array ( [download] => Array ( [name] => Array ( [file1] => MyFile.txt [file2] => MyFile.jpg ) [type] => Array ( [file1] => text/plain [file2] => image/jpeg ) [tmp_name] => Array ( [file1] => /tmp/php/php1h4j1o [file2] => /tmp/php/php6hst32 ) [error] => Array ( [file1] => UPLOAD_ERR_OK [file2] => UPLOAD_ERR_OK ) [size] => Array ( [file1] => 123 [file2] => 98174 ) ) ) So you'd need to access the error param of file1 as, eg $_Files['download']['error']['file1'] ---- Server IP: 92.48.74.199 Probable Submitter: 213.123.188.5 ---- Manual Page -- http://www.php.net/manual/en/reserved.variables.files.php Edit -- https://master.php.net/note/edit/89674 Del: integrated -- https://master.php.net/note/delete/89674/integrated Del: useless -- https://master.php.net/note/delete/89674/useless Del: bad code -- https://master.php.net/note/delete/89674/bad+code Del: spam -- https://master.php.net/note/delete/89674/spam Del: non-english -- https://master.php.net/note/delete/89674/non-english Del: in docs -- https://master.php.net/note/delete/89674/in+docs Del: other reasons-- https://master.php.net/note/delete/89674 Reject -- https://master.php.net/note/reject/89674 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152109) next »