Monday, April 21, 2014

Re: browse a file from my desktop

I believe the question still applies: Does UPLOAD_DIRECTORY exist and can whatever runs your server side code write to it? In the example, it's "d:\\uploaded\\". Is that a real directory on your system? If not, you'll never upload the file.

Try creating your upload file with java.io.File.createTempFile(String prefix, String suffix) or as a file you name in a directory you can write to, like java.io.tmpdir:

...
File uploadedFile = File.createTempFile("gwt", "foo");
item.write(uploadedFile);
resp.setStatus(HttpServletResponse.SC_CREATED);
resp.getWriter().print("The file was created successfully.");
resp.flushBuffer();
... 

Use your development environment's debugger to step through your servlet and see where the error is, or put some System.err.println()'s into your servlet and see where it's failing.

On Monday, April 21, 2014 4:14:00 PM UTC-4, imen boukhris wrote:
Hi Thad
i'm not running my app with tomcat ,i am running it as a web application ,when i debug the code i find that the following line in null"File uploadedFile = new File(UPLOAD_DIRECTORY, fileName);" and I got the following error

Le jeudi 3 avril 2014 00:36:28 UTC+2, imen boukhris a écrit :
Hi GWT community,
how can i upload a file to server from my desktop in my google web toolkit project.Anyone could provide me with good tutorial that explain the file upload solution from start  to end please.
thanks in advance
 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment