commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Schalk" <sch...@volume4.co.za>
Subject Re: Apache File Upload program
Date Tue, 11 Feb 2003 09:13:05 GMT
Alex

Attached is a fileUplaod.java file that should help you in getting the job
done.

Kind Regards
Schalk Neethling
Volume4
Dedicated to an OpenSource World(tm)
Tel: +27125468436
Fax: +27125468436
email: schalk@volume4.co.za
url: www.volume4.co.za
----- Original Message -----
From: "Martin Cooper" <martin.cooper@tumbleweed.com>
To: <Alex.Ng@nokia.com>
Cc: <commons-user@jakarta.apache.org>
Sent: Tuesday, February 11, 2003 7:28 AM
Subject: RE: Apache File Upload program


> First of all, you are more likely to receive a timely and helpful response
> if you post your questions to the appropriate mailing list, as documented
on
> the FileUpload web page, rather than to individuals. I am cc'ing the
> appropriate list on this reply.
>
> For a form field, simply call FileItem.getString() to get the value of the
> parameter.
>
> For a file field, use FileItem.getFileName() to get the base name of the
> uploaded file, and call FileItem.getInputStream() to access the contents.
>
> --
> Martin Cooper
>
>
> > -----Original Message-----
> > From: Alex.Ng@nokia.com [mailto:Alex.Ng@nokia.com]
> > Sent: Thursday, February 06, 2003 8:06 PM
> > To: martin.cooper@tumbleweed.com
> > Subject: Apache File Upload program
> >
> >
> > Hi Martin,
> >
> > I am developing a web application. My web application needs
> > to allow user to upload file from
> > browser to web server.  I found a good file upload Java
> > program at Apache website:
> > http://jakarta.apache.org/commons/fileupload/team-list.html
> >
> > I got it to work on my application. I would like to ask you
> > about retrieving a field
> > value from a form. How do I get it to work ?
> >
> > // Process the uploaded fields
> >             Iterator iter = items.iterator();
> >             while (iter.hasNext())
> >             {
> >                 FileItem item = (FileItem) iter.next();
> >
> >                 if (item.isFormField())
> >                 {
> >                     System.out.println("Form name  -- " +
> > item.getFieldName());
> >         System.out.println("Form value -- " +
> > req.getParameter(item.getFieldName()));
> >     }
> >                 else
> >                 {
> >                     System.out.println("File -- " +
> > item.getFieldName());
> >                     System.out.println("File -- " + item.getName());
> >                     item.write("d:\\temp\\upFile.txt");
> >                 }
> >             }
> >
> > Your help is very much appreciated.
> >
> > Alex
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message