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: [EMAIL PROTECTED]
url: www.volume4.co.za
----- Original Message -----
From: "Martin Cooper" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, February 06, 2003 8:06 PM
> > To: [EMAIL PROTECTED]
> > 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to