Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8931471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:07:17+00:00 2026-06-15T09:07:17+00:00

I have a multiple files upload form: <input type=file name=files multiple /> I am

  • 0

I have a multiple files upload form:

<input type="file" name="files" multiple />

I am posting these files with ajax. I would like to upload the selected files one by one (to create individual progress bars, and out of curiousity).

I can get the list of files or individual files by

FL = form.find('[type="file"]')[0].files
F  = form.find('[type="file"]')[0].files[0]

yieling

FileList { 0=File, 1=File, length=2 }
File { size=177676, type="image/jpeg", name="img.jpg", more...}

But FileList is immutable and I can’t figure out how to submit the single file.

I think this is possible as I saw http://blueimp.github.com/jQuery-File-Upload/. I don’t want to use this plugin however as it’s as much about learning as the result (and it would need too much custimizing anyway). I also don’t want to use Flash.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:07:19+00:00Added an answer on June 15, 2026 at 9:07 am

    For this to be a synchronous operation, you need to start the new transfer when the last one is done. Gmail, for example, send everything at once, concurrently.
    The event for the progress on AJAX file upload is progress or onprogress on the raw XmlHttpRequest instance.

    So, after each $.ajax(), on the server side (which I don’t know what you’ll be using), send a JSON response to execute the AJAX on the next input. One option would to bind the AJAX element to each element, to make things easier, so you could just do, in the success the $(this).sibling('input').execute_ajax().

    Something like this:

    $('input[type="file"]').on('ajax', function(){
      var $this = $(this);
      $.ajax({
        'type':'POST',
        'data': (new FormData()).append('file', this.files[0]),
        'contentType': false,
        'processData': false,
        'xhr': function() {  
           var xhr = $.ajaxSettings.xhr();
           if(xhr.upload){ 
             xhr.upload.addEventListener('progress', progressbar, false);
           }
           return xhr;
         },
        'success': function(){
           $this.siblings('input[type="file"]:eq(0)').trigger('ajax');
           $this.remove(); // remove the field so the next call won't resend the same field
        }
      });
    }).trigger('ajax');  // Execute only the first input[multiple] AJAX, we aren't using $.each
    

    The above code would be for multiple <input type="file"> but not for <input type="file" multiple>, in that case, it should be:

    var count = 0;
    
    $('input[type="file"]').on('ajax', function(){
      var $this = $(this);
      if (typeof this.files[count] === 'undefined') { return false; }
    
      $.ajax({
        'type':'POST',
        'data': (new FormData()).append('file', this.files[count]),
        'contentType': false,
        'processData': false,
        'xhr': function() {  
           var xhr = $.ajaxSettings.xhr();
           if(xhr.upload){ 
             xhr.upload.addEventListener('progress', progressbar, false);
           }
           return xhr;
         },
        'success': function(){
           count++;
           $this.trigger('ajax');
        }
      });
    }).trigger('ajax'); // Execute only the first input[multiple] AJAX, we aren't using $.each 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have that basic, well known multiple file upload form. Something like that... <input
I'm setting a form so i can upload multiple files: <div> <input type=hidden name=MAX_FILE_SIZE
I have a form that allows for multiple file uploads. <input name=uploadedfile[] type=file multiple=true/>
Can I use: <input type=file name=files id=files multiple=multiple /> and bind it to: [HttpPost]
I have form with many input fields plus primefaces component to upload multiple file
I would like to have multiple files in a folder with are managed by
I'm trying to upload multiple files at once but have a solo form field
How to upload multiple files with ->setFileUpload()? For example i have this: <form method=post
Have a form here with bunch of input text fields and a file upload
I have an HTML web form where users can upload multiple files. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.