8

Anybody know how GWT file upload works? I know about FileUpload widget and how to use it. I want to know what is its inner mechanism. We can't get contents of file from FileUpload widget in client and how it is going to server? I googled it but i didn't get solution.

Thanks in advance.

Ravi
  • 123
  • 2
  • 6

2 Answers2

5

GWT's file upload makes use HTML's input element. The html input element is native html dom element which allows to select files from your system.

After selection you need to submit it to your server. This is done by the GWT's FormPanel.

In particular, FileUpload is only useful when used within a FormPanel, because the browser will only upload files using form submission.

Note:

1) You can read about how to code with formpanel and fileupload as answered here @ Basic File upload in GWT

2) If you are concerned with processing the file on client side and not pushing the file to server then you have limited options as mentioned here @ How to retrieve file from GWT FileUpload component?

Community
  • 1
  • 1
appbootup
  • 9,537
  • 3
  • 33
  • 65
0
formPanel.setAction(GWT.getModuleBaseURL()+"uploadHandler");     
formPanel.setMethod(Method.POST);

when we use formPanel.submit(),we can invoke the servlet and get the file upload details.

swamy
  • 1,200
  • 10
  • 23