Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Feb 2004
    Location
    Malaysia
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy uploading multiple images

    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.
    Warm Regards,
    Mivec

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    Regular Coder
    Join Date
    Apr 2004
    Location
    Los Angeles
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here's a code sample:
    PHP Code:
    echo("<form method='post' action='modUpload.php' enctype='multipart/form-data'>");
    for(
    $a=0$a<30$a++) {
      echo(
    "<input type='file' name='file$a'>");
    }
    echo(
    "</form>"); 
    Then on modUpload.php something like this:

    PHP Code:
    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"); 
       }



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •