I'm looking for a way to do file uploads, with a custom progress bar, with google web toolkit. Not looking for a plugin which shows its own progress bar, I'm rather looking for something which will call my callback method and notify it of progress, so I can show my own progress bar.
If that's not possible, then I'd like to know how to access the HTML5 File API so I can build my own file uploader widget.
Any ideas?
Thanks.
All the building blocks are in Elemental but might not work everywhere (Elemental is "close to the metal", without any support detection or hiding/working around browser bugs/discrepancies).
Or you can use JSNI.
There are many issues in GWT which makes difficult deal with this:
FormData
object in GWT, so you have to use JSNI to get one.RequestBuilder
does not support sendingFormaData
but only strings.RequestBuilder
does not support upload or download progress notifications.FileUpload
does not support the multiple attribute.Fortunately, gwtquery 1.0.0 has a bunch of features which facilitates to solve the problem.
Here you have a working example (with very few lines of code), which works in all browsers supporting the HTML5 file api:
Another option is to use gwtupload, which supports any browser, and it comes with some nice widgets and progress bar, even you can plug your own progress and status widgets.
It does not use HTML5 File api yet but an ajax solution based on a server listener. It will though, support html5 in future versions, falling back to ajax mechanism for old browsers. When gwtupload supports this, you wont have to modify anything in your code.