View Full Version : uploading multiple images

03-30-2004, 05:57 PM
hi all,
ok, last time i manage to upload images(one by one) into the database.not the picture to the database but just the path. but now, i need to upload more than 30 images at one click of a button. does anyone have the code?it's kinda an emergency.....pls help.thank you.

03-30-2004, 06:08 PM
Can't you just modify your existing code to be able to handle multiple images at a time? Obviously whatever code you are using to handle things should be put into a function and then call that function for each image that needs to be processed.

04-01-2004, 06:12 AM
Here's a code sample:

echo("<form method='post' action='modUpload.php' enctype='multipart/form-data'>");
for($a=0; $a<30; $a++) {
echo("<input type='file' name='file$a'>");

Then on modUpload.php something like this:

foreach($HTTP_POST_FILES as $file) {
if (!(copy($_FILES["file"]["tmp_name"], "/".$HTTP_POST_FILES[$file]["name"]))) {
printf("<b>Error: Could Not Upload file: %s</b>", $HTTP_POST_FILES["file"]["name"]);
} else {
printf("File Uploaded Successfully");