If your document is text, you can do what I did--return the text in the addSubmitCompleteHandler:
form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) { // This event is fired when the form submission is successfully completed. String result = event.getResults(); GWT.log(result.substring(0, 40), null); parseDocument(result); } }); I return the entire file, but you could strip out what you need and go from there. NOTE: Because of IE you must, *must*, **MUST** set the content type to text/html or IE will wrap it in all sorts of garbage. In my upload servlet (using the Apache Commons FileUpload). @SuppressWarnings("unchecked") protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); // Create a factory for disk-based file items DiskFileItemFactory factory = new DiskFileItemFactory(); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); // Parse the request, and temporarily store file. try { List<FileItem> items = upload.parseRequest(request); Iterator<FileItem> iter = items.iterator(); while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); if (item.isFormField()) { //String name = item.getFieldName(); } else { // If no item name, no file has been selected. if ( item.getName().length() > 0 && item.getSize() > 0 ) { byte [] data = item.get(); String xml = new String(data); out.write(xml); } } } // end WHILE } catch (FileUploadException e) { e.printStackTrace(); out.println(e.getMessage()); return; } } On Aug 11, 5:22 pm, Greg Dougherty <dougherty.greg...@mayo.edu> wrote: > My users want my app to be able to read data from a local file. So > far as I can tell, the only way to do this is to have a FileUpload > Widget in a form, send the contents of the file to the server, and > then get the contents from the server (i.e. send the form with a > unique ID attached, then make an RPC call asking for the contents of > the file with that unique ID). > > Is there another way to do this? Does there exist sample code on how > to do this? > > TIA, > > Greg -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.