views:

640

answers:

3

If there's a way for the client side GWT code to pre-process a file on the client computer? For example, to calculate a checksum of it before submitting the file to the server.

A: 

I'm pretty sure that because GWT code compiles to pure JavaScript, there isn't a way without requiring some third-party browser plugin.

Ben Alpert
A: 

Do you mean from an <input type="file"...> file upload field in a form?

The short answer is no-- file uploads are handled by the browser, and are sent directly to the server (as an ENCODING_MULTIPART POST). And security restrictions on JavaScript mean there's no way to workaround that restriction.

gavinandresen
+1  A: 

No it is not possible. The manipulation of the file is done by the browser, not the HTML code.

Think about it, GWT is 100% javascript. And javascript has no access whatsoever of the file in your computer. That would be an pretty big security risk! GWT "wraps" the file input box so it can be displayed inside the GWT panel. But once you press the "upload" button, the upload is done by the browser.

You could do file manipulation with another technology however. Java applets for example. But that is outside of GWT area...

Thierry-Dimitri Roy