I am not interested to use any 3rd party library.
So i am trying with FileUpload with Formpanel as follows,

Html:

        <input type="file" id="uploadBtn"/>
  <button type="button" id="submitBtn">Upload</button>

Java code as follows:

final FormPanel fp = new FormPanel();
fp.setMethod(FormPanel.METHOD_POST);
fp.setEncoding(FormPanel.ENCODING_MULTIPART);
VerticalPanel vp = new VerticalPanel();
Button sub = Button.wrap(DOM.getElementById("submitBtn"));
final FileUpload fu = FileUpload.wrap(DOM.getElementById("uploadBtn"));
vp.add(fu);
vp.add(sub);
fp.add(vp);

sub.addClickHandler(new ClickHandler() {
 @Override
public void onClick(ClickEvent event) {
fp.submit();
}
});
 fp.addSubmitHandler(new SubmitHandler() {
 @Override
public void onSubmit(SubmitEvent event) {
greetingService.greetServer(fu.getFilename(), new AsyncCallback<String>() {
 @Override
public void onSuccess(String result) {
Window.alert(result);
}
 @Override
public void onFailure(Throwable caught) {
 }
});
}
});
RootPanel.get().add(fp);

It is working fine but the problem is on the server side i am getting only
file name(fp.getFilename()). So i am not able to get the inputstream from
client.

Can you pls guide me how to get this file on server.

Thanks
Deepak

On Sat, Nov 12, 2011 at 9:17 PM, Warren Tang <[email protected]>wrote:

> You can use gwtupload widget which works without a form:
> http://code.google.com/p/gwtupload/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/oHIgm4CUufsJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>



-- 
Deepak Singh

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to