Instead, there were many closed-sourced applets with restrictive and expensive licenses, and a few sites which offered code snippets. So I decided to try my luck and build on the code I found.
In particular, I used code from a tutorial by Zack Grossbart.
The result has the following features:
- For each file to upload, a multipart/form-data POST request compatible to normal file upload forms is sent
- Basic HTTP authentication
- A progress bar that shows the progress of each individual file upload
- A button to clear the upload list or cancel ongoing uploads
- The code comes with a PHP script for the server that accepts the incoming data, but the backend could be written in any language.
If you want the code, there’s SVN acccess, and you can also download a GNU tarball. The code can be browsed online here. If you have suggestions how to improve the code, leave a note or send a diff to info/at/bibliograph/dot/org.
P.S.There are some wierd issues:
- The other concerns the visibility of the applet. When the iframe is hidden (for example, when it is part of a tab page that is not active), and then become visible again, it is not repainted. A call to “repaint” doesn’t help, and I couldn’t figure out how to deal with th “paint(Graphics g)” method. I ended up with a programmatic resizing of the iframe – then the applet is redrawn. This occurred in Firefox, but not in Safari.
- Finally, when there are more than one Firefox instance displaying the same applet, drag and drop doesn’t work anymore and a NullPointerException is thrown. A similar problem is described here.
- I have not tested the previous points for later browser versions, please let us know if they still exist.
- An alternative java applet can be found here.
- If you don’t like java applets, try Digitarald’s “Fancy Upload” based on Flash.
- Multiple-File upload is coming in HTML5 and some browsers already support it. The java applet will might no longer be required.