There are actually two ways to download a file from gwtupload, as you mentioned, and through gwt-rpc this is a bit complicated due to browser security. To implement with gwt-rpc, you must override the service(final HttpServletRequest request,HttpServletResponse response) method service(final HttpServletRequest request,HttpServletResponse response) inside your service implementation that inherits RemoteServiceServlet . On the client side, you should have code like this:
final FormPanel formPanel = new FormPanel(); formPanel.setAction(GWT.getModuleBaseURL()+"fileUpload"); formPanel.setEncoding(FormPanel.ENCODING_MULTIPART); formPanel.setMethod(FormPanel.METHOD_POST);
Inside the service you can get the file using FileUpload and don't forget to register the file url template in your web.xml as well as @RemoteServiceRelativePath("path") in your service interface, which inherits RemoteService . Good luck
Õzbek source share