Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005

    Unanswered: multiple files upload

    I have a multiple files upload form and a method of a class that take each file upload that and insert at db the name of this file.
    How can I make a loop and pass the file to the method?
    I found this
    foreach (  $_FILES['myfile'][name] as $key => $value )
    But how I can pass the hole file and not just the properties?

  2. #2
    Join Date
    Mar 2007
    Ok, how best to explain this?
    Each file is uploaded into your /tmp directory. So the ACTUAL files are stored there. What you have in PHP is the information about those files (inside $_FILES[]) which you can use.

    Go here and look at example 3, it deals with multiple file uploads.

    Basically inside your loop you need to insert the information into the database and move the uploaded file from the tmp directory (specified by $_FILES["pictures"]["tmp_name"][$key]) to wherever you need it using the move_uploaded_file() function.

Posting Permissions

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