Geert,

You can do the upload using HTML forms.  There is some sample code on jguru
to do this.

You use an HTML "file" element, which handles all the directory browsing
and file selection for you.  When you submit this form, the file is
uploaded in the request.

The trick is that you must extract the file from request on the servlet
side.  The request is a MULTIPART-MIME request.  The file and all other
other request variables are put into one MULTIPART REQUEST.On the jguru
site there are several code examples for decoding this request.
Alternatively you can read up on the multi part request handle it yourself.

Hope this helps,
Regards,

Ruan Viljoen
Java Web Developer
Sanlam Life : Information Technology
Tel: (+2721) 947-8498






                    Geert Van Landeghem
                    <[EMAIL PROTECTED]>         To:     [EMAIL PROTECTED]
                    Sent by: "A mailing          cc:
                    list for discussion          Subject:     servlet file upload?
                    about Sun
                    Microsystem's Java
                    Servlet API
                    Technology."
                    <SERVLET-INTEREST@JAV
                    A.SUN.COM>


                    11/02/2002 10:06 AM
                    Please respond to "A
                    mailing list for
                    discussion about Sun
                    Microsystem's Java
                    Servlet API
                    Technology."






How do you upload a file with http and servlets? Does anybody have
an example of this? I have already written a servlet that let's you
browse the directory structure of the webserver and let's you
download files if wanted. Now I want to build the upload feature...

Thanks in advance,



Geert Van Landeghem
Reynders Etiketten N.V
*   +32-(0)3/460.32.81
* +32-(0)3/455.18.83
M      +32-0477/75.95.33
*   [EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html





***************
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be those of Sanlam, to
whom no liability shall attach whatsoever.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to