PHP Upload Multiple Files Array Programming Tutorial

useful site

Lesson Code:
Learn to program PHP multiple file upload applications. Which is the art of uploading many files as an array in a single form request, and moving them to your server all at once. At the end of the lesson we link you to an Ajax and PHP file upload application with HTML5 progress bar included that you can take to experiment with sending files through Ajax. We also discuss your server limits regarding how many files can your specific server can upload simultaneously and the size the files can be. Each server can be set differently by the server administrator using the php.ini configuration file.


28 thoughts on “PHP Upload Multiple Files Array Programming Tutorial”

  1. Im facing problem with directory . I created the two files in same directory but I ran it on local server it says:unable to move_uploaded_file(….) to ….; what should I do?

  2. I have a form to add sheet music to a database. I would like to upload an mp3 and a sample pdf file of the piece. The mp3 file should be moved to a folder named audio, the pfd to a folder named pdf_samples. How can I define a different destination for the files?


  3. Hello, how do we direct php to a specific folder and let it search the folder for say .mp4 files and parse them rather then select each individual file one at a time, if your trying to parse say all dir within the F: dir that contain .mp4.

  4. Hi Guys. Help a brother out. I tried this tutorial and everything works sweet like a charm, however I stumbled upon something: Anytime I select files in a non-contiguous manner, my upload script doesnt seem to run.For example: If I select just one file using the FIRST file input; everything is okay. However if I select a TWO files using say…the FIRST and THIRD..nothing happens, no uploads. Anybody has an idea why this would happen???

  5. thank you for this video, modified a bit,, with move_upload_to and you got different folder for each file..

    if we have two condition with if statement like :
    if(move_uploaded_file($tmp_name_array[0], "test_uploads/".$name_array[0]) &&
    move_uploaded_file($tmp_name_array[1], "test_uploads2/".$name_array[1])){

    is there a better way to do this than with && ??

  6. Great video.  Can you advise how to limit the TYPE of files that can be uploaded.  I dont want someone to upload an exe or ini file.  I need to keep them to jpg, jpeg, gif, doc, docx and pdf.  I attempted this: if ($type_array= "jpg" && $type_array= "gif" ………and so on.  But the long and short is, its still allowing files to upload regardless of their type.

  7. This tutorial is great, Thank you. I got stuck a little with the whole "Size" issue because I was in hurry and i didn't pay attention to your explanation but finally i got it right and it worked perfectly for me, Keep it on man.

  8. After I upload several files. What if I want to upload 1 file after the 1st time of multiple files? First time, I upload four files from four inputs. The second time, I uploaded one. But because I have line of code (w/ file_exist()), the second time around spits out "upload success" and "file already exist". Not sure why. I'm assuming the other three input tags outputs = "." or "..", and that's why php assumes the file already exist. Can you help me out here?

Leave a Reply

Your email address will not be published. Required fields are marked *