Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

How does upload multiple files work

Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

I've an application where the user upload multiple files at the same time, all this through the use of apache's fileupload, HTML DOM and iframe submits (there's one html form per file to be uploaded, and one iframe per html form).
I decided to feedback the user with the upload progress, so I implemented ProgressListener, set a progress listener within the servlet that uploads the file, and use ajax calls in the jsp to get the percent uploaded. By the way, in the servlet I set one progress listener per file and store it in the user's session, in that way I can track the uploading progress for each file.
I use ajax to get the percent uploaded of each file, and a javascript timeout to call this ajax function. Once I got the ajax response, I write the upload progress within a div:

So, just to have the idea of what I've coded in the jsp:

When I submit one file, the upload progress is successfully updated within the div. I can actually see 0%, 5%,...25%,..56%...82%... 100%

The thing is that, for some unknown reason (to me), whenever I submit more than one file, the div isn't updating with the progress of each file... it's just updated sometimes 'twice': when the first file has been submited, and when a file (1st, 2vd, 3rd, ...) has been uploaded.

Mmm.. so, How does upload multiple files work?

The ajax call to get the upload percent, is being called every second. What happens when I call the servlet 'A' with AJAX, and in the middle of this I called one more time servlet 'A' (in this 2nd time I track another progresslistener)? Does the first request stop serving?
Any ideas how to show the upload progress of each file if I'm using a form and iframe per file?

Thank you!
Posts: 2856
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Recently there was a discussion on this topic. You can find it here .
Also searching the Servlet and JSP forums will bring more results to you.
Lastly this question does not relate to servlets, maybe its related to Ajax. Anyways one of the moderators will move it to its proper place.

Hope this helps
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic