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 :
- Use DWR (IMO the simplest and easiest java AJAX library out there)
- Implement an OutputStreamListener to store the progress information somewhere (in the session, in a file, in a static var, you name it)
- Implement an AJAX service to read this information so you can use it in your upload page
- 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.


