note 40023 deleted from features.file-upload by aidan
| From: | aidan@php.net | Date: | Thu, 05 Aug 2004 07:46:59 +0000 |
| Subject: | note 40023 deleted from features.file-upload by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73979@lists.php.net to get a copy of this message | ||
Note Submitter: brandon@NOSPAM.focusthis.net
----
In addition to the note posted by: user at php dot net talking
about uploading multiple files...
to be a little more flexible you can use this:
<form enctype="multipart/form-data" action="uploadtest3.php"
method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
Send this file: <input name="userfile[]" type="file" /><br>
Send this file: <input name="userfile[]" type="file" /><br>
Send this file: <input name="userfile[]" type="file" /><br>
<input type="submit" value="Send File" />
</form>
note the use of the "userfile[]" as the name of each file input. you can use this php code
to navigate through the array and display the contents of $_FILES:
<?php
foreach ($_FILES as $key1 => $value1) {
echo "\$_FILES[$key1] = $value1<br>\n";
foreach ($value1 as $key2 => $value2) {
echo "\$_FILES[$key1][$key2] = $value2<br>\n";
foreach($value2 as $key3 => $value3) {
echo "\$_FILES[$key1][$key2][$key3] = $value3<br>\n";
}
}
}
?>
I'll leave the rest up too you :)