Uploading multiple files note

From: Date: Sat, 31 Jan 2004 08:35:18 +0000
Subject: Uploading multiple files note
Groups: php.doc php.doc 
Request: Send a blank email to phpdoc+get-969358639@lists.php.net to get a copy of this message
Hi, I recently added a note to the 'Uploading multiple files' page and made a tiny little mistake. Is it possible for you to edit it for me (since there is no editing procedure)? My note is: 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); } ?> It is possible for you to change the second 'if' statement from: if (!move_uploaded_file($_FILES['secondfile']['tmp_name'], $uploadfile1)) { to if (!move_uploaded_file($_FILES['secondfile']['tmp_name'], $uploadfile2)) { ??? Thank you, Peter

« previous php.doc (#969358639) next »