note 87223 added to reserved.variables.files
| From: | admin at studio-gepard dot pl | Date: | Tue, 25 Nov 2008 11:05:35 +0000 |
| Subject: | note 87223 added to reserved.variables.files | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146909@lists.php.net to get a copy of this message | ||
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))
----
Server IP: 82.160.94.10
Probable Submitter: 87.105.8.63
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.files.php
Edit -- https://master.php.net/note/edit/87223
Del: integrated -- https://master.php.net/note/delete/87223/integrated
Del: useless -- https://master.php.net/note/delete/87223/useless
Del: bad code -- https://master.php.net/note/delete/87223/bad+code
Del: spam -- https://master.php.net/note/delete/87223/spam
Del: non-english -- https://master.php.net/note/delete/87223/non-english
Del: in docs -- https://master.php.net/note/delete/87223/in+docs
Del: other reasons-- https://master.php.net/note/delete/87223
Reject -- https://master.php.net/note/reject/87223
Search -- https://master.php.net/manage/user-notes.php