Re: Reading a local file
If you really must keep it on the client side you could use a signed Java applet but that is quite a lot of work and various hassles with different platforms. JS/Applet communication works pretty well. -- 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.
Re: Reading a local file
actually, its the way you look for, you can also make a classic FileUpload using just HTML forms and write own servlet to save/parse the contents and to return the results in old-web manner (full page reload) On 11 Aug., 23:22, 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.
Reading a local file
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.
Re: Reading a local file
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 { ListFileItem items = upload.parseRequest(request); IteratorFileItem 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.
Re: Reading a local file.
edarroyo schrieb: Is it possible to read a file that resides on the user's computer? Isn't it possible to look for messages using a search engine to check if that question has been asked before? http://groups.google.com/group/google-web-toolkit/search?group=google-web-toolkitq=read+local+file should answer your question already. Regards, Lothar -- 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.
Reading a local file.
Is it possible to read a file that resides on the user's computer? My applications does not need a server so all the code would reside on the client side. I want the user to point me to a file on his computer so I can read and calculate some data and then just display with no kinds of calls to the backend. Thanks! -- 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.