PHP » Predefined Variables » Files

Syntax:
$_FILES

Files can be uploaded from a browser to the server with forms using the "file" input type. Information about the uploaded files are available in this array.

Examples

Code:
<form enctype="multipart/form-data" action="upload2.php" method="post">
Upload file: <input name="userfile" type="file">
<input type="submit" value="Upload">
</form>
Output:
A form is displayed.
Explanation:

HTML code for uploading a file. Use together with the next code sample.

Code:
<pre>
<?php

print_r($_FILES);

?>
</pre>
Output:
Array
(
   [userfile] => Array
       (
           [name] => boot.ini
           [type] => application/octet-stream
           [tmp_name] => \tmp\php878.tmp
           [error] => 0
           [size] => 193
       )
)
Explanation:

Prints information about uploaded files.

See Also: