if you mean common fileupload. it should be at the server.
nope for web.xml. and nope for project.gwt.xml --> since you putting
common fileupload to the server.
try to be more clear ini what u want? and where is the problem.


On Jul 21, 4:13 pm, Vinz369 <vincentriv...@gmail.com> wrote:
> Hello twittwit and others,
>
> I've been trying to implement file upload for days in my application.
> It may looks stupid but I really don't understand how it works.
> I have few questions:
> - If I want to use the same code as twittwit where should I place it?
> in my client folder or server folder? should I add something else in
> my web.xml and project.gwt.xml files?
>
> I'm completely lost, please help me!
>
> On Jul 18, 10:15 am, twittwit <ytbr...@gmail.com> wrote:
>
> > perfect! thanks Manuel!
> > common-fileupload is great!
> > On Jul 18, 8:51 am, Manuel Carrasco <manuel.carrasc...@gmail.com>
> > wrote:
>
> > > filename = item.getName();
>
> > > On Sat, Jul 18, 2009 at 12:27 AM, twittwit <ytbr...@gmail.com> wrote:
>
> > > > ok thank you. i found the answer:
>
> > > > public class MyFormHandler extends HttpServlet{
> > > >    public void doPost(HttpServletRequest request, HttpServletResponse
> > > > response)  throws ServletException, IOException {
> > > >        ServletFileUploadupload= new ServletFileUpload();
>
> > > >        try{
> > > >            FileItemIterator iter =upload.getItemIterator(request);
>
> > > >            while (iter.hasNext()) {
> > > >                FileItemStream item = iter.next();
>
> > > >                String name = item.getFieldName();
> > > >                InputStream stream = item.openStream();
>
> > > >                // Process the input stream
> > > >                FileOutputStream out = new FileOutputStream
> > > > ("example.csv");
> > > >                //ByteArrayOutputStream out = new ByteArrayOutputStream
> > > > ();
> > > >                int len;
> > > >                byte[] buffer = new byte[8192];
> > > >                while ((len = stream.read(buffer, 0, buffer.length)) !
> > > > = -1) {
> > > >                    out.write(buffer, 0, len);
> > > >                }
> > > > //.......
>
> > > >            }
> > > >        }
> > > >        catch(Exception e){
> > > >            e.printStackTrace();
> > > >        }
>
> > > >    }
>
> > > > }
>
> > > > however, how can i extract the name of the csv file(client side) so
> > > > that the csv file in my server can have the same name?
> > > > thanks!!
>
> > > > On Jul 18, 12:19 am, Manuel Carrasco <manuel.carrasc...@gmail.com>
> > > > wrote:
> > > > > In the dialog between the browser and the server, the client sends a
> > > > > multipart/form-data request and there is more information besides the
> > > > file
> > > > > content, like form elements values, boundary tags, etc.
>
> > > > > I recommend you to use apache commons-fileupload library to handle
> > > > > multipart/form-data request in your servlets.
>
> > > > > On Fri, Jul 17, 2009 at 11:44 PM, imgnik <ytbr...@gmail.com> wrote:
>
> > > > > > hi all,
>
> > > > > > i posted a question about fileupload here
>
> > > > > >http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa.
> > > > ..
> > > > > > but i think i didn't phrase my question correctly. so gonna do 
> > > > > > another
> > > > > > attempt.
>
> > > > > > I tried to use agwtfileupload widget to send a csv file to the
> > > > > > server. and at the server i will write it as a file (for other 
> > > > > > usage)
> > > > > > it by doing : (where request is the httpservletrequest and bw is the
> > > > > > bufferedwriter)
>
> > > > > >  BufferedReader r = request.getReader();
> > > > > >          while((thisread= r.readLine())!=null){
>
> > > > > >                  bw.write(thisread);
>
> > > > > >          }
> > > > > >      bw.close();
> > > > > >          }
> > > > > >          catch(Exception e1){}
>
> > > > > > however, i realised that the csv file send out contains :
>
> > > > > > ------WebKitFormBoundaryN8Z6DOy7DqEWTwtLContent-Disposition: form-
> > > > > > data; name="uploadFormElement"; filename="first.csv"Content-Type:
> > > > > > application/octet-streamBank
>
> > > > > > which results in the file created not the same as the fileupload.
> > > > > > I might be wrong in my analysis. can someone advice me?
--~--~---------~--~----~------------~-------~--~----~
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-Toolkit@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to