AJAX Upload progress monitor for Commons-FileUpload

Here is a little addition to the Jakarta File Upload library to allow to monitor the progress of the file upload.

An OutputStreamListener can be used with a MonitoredDiskFileItemFactory. It will be informed of the progress of the HTTP file upload.

To implement a nice AJAX upload progress bar, here is how I did it :

  1. Use DWR (IMO the simplest and easiest java AJAX library out there)
  2. Implement an OutputStreamListener to store the progress information somewhere (in the session, in a file, in a static var, you name it)
  3. Implement an AJAX service to read this information so you can use it in your upload page
  4. Implement some basic javascript to trigger the AJAX calls every n milliseconds

I’ll post a full example in a future post if I have time (which I probably won’t, but if I am overwhelmed with comments I’ll try to take the time :-) )

You can download the code here

P.

2 Responses - Leave yours here.

  • This is a good example that shows how DWR and commons file upload can be used togather to develop a progress monitor

    Thanks for sharing

  • Hello, this is so cool, i use it on one application, with a little modifications, but i got a problem, maybe u can help me to track it, try ur application in safari web browser, the progress bar doesn’t refresh, but the document is attached.

    Any tip will be nice, thank u.

Leave a comment

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