Forum Moderators: coopster
Then you just have to do your uploading for each seperate file.
I use this for multiple uploads on one form
while ($upcount <= $imgremain) {
echo "<b>Image",$upcount,"</b>";
echo "Description ",$upcount,": <input name=\"description",$upcount,"\" size=\"50\" maxlength=\"80\">";
echo "File ",$upcount,": <input type=\"file\" name=\"userfile",$upcount,"\"><br> ";
$upcount++;
}
they are allowed a set number of uploads so it creates a file field for each remaining upload, hence the test in the while loop. Then in the script I have
while ($imagecounter <= $max_images) {
...lots of code missing...
if (move_uploaded_file($_FILES["userfile" . $imagecounter]['tmp_name'], $full_uploaddir . $tempic)) {
$desc = mysql_escape_string(${"description" . $imagecounter});
$iiq = "INSERT INTO listing_imgs VALUES (" . $newid . ",'" . $desc . "', " . $listing_id . ",'no',0,'none'," . $p_order . ",'" . $desc . "','','')";
mysql_query($iiq) or die(mysql_errno().": ".mysql_error()."<BR>");
} else {
echo "<b>",$_FILES['userfile']['name'],"</b> did not upload!";
die;
}
...lots of code missing...
$imagecounter++;
}
Where $imagecounter is incremented to control which image is being dealt with
I trimmed out a bunch of code out of both of those snippets(I may have even broken them) but you get the idea.
Here's another example of uploading multiple images [webmasterworld.com]. You have to scroll down the page to find the post called "Image upload and Thumbnail Generator".
Birdman
p.s. That script creates thumbnails too, just ignore that part.