For security reasons, <input type="file"... element cannot have a value set 
programmatically. For an example why not, 
see http://stackoverflow.com/a/1696884/1316011  (If you have code showing 
otherwise, I'm sure I'm not the only one who'd like to see it.)

As for uploading a file, the example in the GWT JavaDoc for FileUpload 
works. Obviously you need a servlet that saves the file. I use Apache 
Commons FileUpload for my servlets 
(http://commons.apache.org/proper/commons-fileupload/).

Once you get the file up, you can use a GWT RPC call to open the file, to 
convert it to a Base64 string, and return it to your browser where you can 
call Image.setUrl(...your-Base64...). However it would be faster and 
simpler to write a servlet that streams the image back to you, and call 
that servlet in Image.setUrl()

On Friday, September 6, 2013 12:40:06 AM UTC-4, Xybrek wrote:
>
> I managed to get a blob and create a URL for it which I put in a img tag 
> src attribute to show the image like this:
>
> <img class="gwt-Image" data-field="image" src="blob:http%3A//127.0.0.1
> %3A8888/757c3c87-de5c-4c54-897e-9d043bc2895c">
>
> My question would be how would I upload this blob via GWT FileUpload with 
> com.google.gwt.user.client.ui.FormPanel? 
>
> Also the com.google.gwt.user.client.ui.FileUpload does not have a 
> setFilename method to programatically set the filename as oppose to 
> selecting via File/Window box. 
>
> So, it seems its like impossible to do this with GWT, I've seen pure 
> Javascript solution. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to