note 40023 added to features.file-upload
| From: | brandon at NOSPAM dot focusthis dot net | Date: | Thu, 19 Feb 2004 08:05:33 +0000 |
| Subject: | note 40023 added to features.file-upload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65372@lists.php.net to get a copy of this message | ||
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 :)
----
Manual Page -- http://www.php.net/manual/en/features.file-upload.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40023
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40023&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40023&report=yes
Search -- http://master.php.net/manage/user-notes.php