aspose file tools*
The moose likes Servlets and the fly likes get file upload progress for multiple files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "get file upload progress for multiple files" Watch "get file upload progress for multiple files" New topic
Author

get file upload progress for multiple files

Angel J Gama
Ranch Hand

Joined: Jun 28, 2007
Posts: 36
Hi,

I've a working 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... in fact I NEED it this way).

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.

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.

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!
[ September 18, 2008: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: get file upload progress for multiple files