What is your ultimate goal, to generate a chunk of Base64-encoded text, then do what with it? Stash it somewhere on the server? Do something more with it on the client? It's impossible to write to a local (client) file using GWT/JavaScript (I'm disregarding additional plugins here).
On *some bleeding-edge browsers*, it is now possible to read (not write) a client-side file after the user has selected it in the FileUpload. But if you write code that depends on FileAPI, it won't work in all current browsers. OTOH, a server-centric approach is pretty much guaranteed to work with any browser. http://dev.w3.org/2006/webapi/FileAPI/ On Oct 19, 11:48 am, Ignasi <murf...@gmail.com> wrote: > First of all, thanks a lot for your answer. You understand perfectly > my problem and i have understood your answer. > I can assume that what i want is imposible from client side. > I would prefer dont write an independent servlet because on my server > side i have a REST server, so i guess use it is better. > If i never can write a local file from javascript, the only way that i > have is upload the file (i guess i would can get the path or file to > do it) and transform on the server side. > What would be the better way to do it? FormPanel with submit button > (and fileupload of course)? Use JQuery? Flash component? > > Thanks a lot!! > Ignasi > > 2010/10/19 Jim Douglas <jdou...@basis.com>: > > > > > Let's see if I understand your requirements: > > > You want to have the user select a file using a FileUpload on a > > FormPanel. > > You then want to perform some transformations on that file, including > > generating a Base64 string. > > You want the final result of those transformations to reside on the > > server? > > > First, eliminate the impossible: > > > * You cannot write a file on the client. This isn't a GWT > > restriction, it's a core browser restriction. This restriction is why > > it's impossible for GWT to emulate java.io.File (http:// > > code.google.com/webtoolkit/doc/latest/RefJreEmulation.html). > > * You cannot access the path of the file (but this is rarely a > > concern). > > > What you want to do is: > > > * Write a FileUploadServlet that resides on your server. > > * Receive the uploaded file in the doPost method of that servlet. > > * Do all of your transformations there on the server. > > > Make your life easy -- grab the Apache FileUpload package from > >http://commons.apache.org/fileupload/, add it to your server > > classpath, and use it to manage the file upload process in > > FileUploadServlet. > > > On Oct 19, 4:36 am, null <murf...@gmail.com> wrote: > >> Hi all, > >> there some way to use java.io.file in client side of my GWT Project? > >> I need convert a file to string and then to base64. > >> -I have a javascript code which can convert a string to base64 > >> -I have a DialogPanel with a FileUpload which get the path and name of > >> the file that i want upload > > >> So i just need a way to manipule a file in Gwt. > > >> Thanks all! > > > -- > > 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 > > athttp://groups.google.com/group/google-web-toolkit?hl=en. -- 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.