note 39516 added to features.file-upload.multiple
| From: | php-general at lists dot php dot net | Date: | Sat, 31 Jan 2004 08:07:53 +0000 |
| Subject: | note 39516 added to features.file-upload.multiple | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64469@lists.php.net to get a copy of this message | ||
Why even bother with uploading multiple files into an array? If you are expecting files for
particular reasons, just name each upload differently. So for example, your HTML code might look
like this:
<FORM ACTION="upload.php" METHOD="POST"
ENCTYPE="multipart/form-data">
Send these files:<BR>
<INPUT TYPE="FILE" NAME="firstfile" SIZE="50"><BR>
<INPUT TYPE="FILE" NAME="secondfile" SIZE="50"><BR>
<INPUT TYPE="SUBMIT">
</FORM>
And in 'upload.php' have the following code:
<?PHP
$uploaddir = "uploads/";
$uploadfile1 = $uploaddir . $_FILES['firstfile']['name'];
$uploadfile2 = $uploaddir . $_FILES['secondfile']['name'];
if (!move_uploaded_file($_FILES['firstfile']['tmp_name'], $uploadfile1)) {
print "ERROR: File is invalid";
print_r($_FILES);
}
if (!move_uploaded_file($_FILES['secondfile']['tmp_name'], $uploadfile1)) {
print "ERROR: File is invalid";
print_r($_FILES);
}
?>
----
Manual Page -- http://www.php.net/manual/en/features.file-upload.multiple.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39516
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39516&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39516&report=yes
Search -- http://master.php.net/manage/user-notes.php