note 39516 deleted from features.file-upload.multiple by aidan
| From: | aidan@php.net | Date: | Sun, 19 Sep 2004 03:28:10 +0000 |
| Subject: | note 39516 deleted from features.file-upload.multiple by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76963@lists.php.net to get a copy of this message | ||
Note Submitter:
----
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'], $uploadfile2)) {
print "ERROR: File is invalid";
print_r($_FILES);
}
?>