David,

in the FORM-tag of the HTML-file you should, as you mention, have a
'enctype="multipart/form-data' attribute. The receiving servlet could use
the MultipartRequest class which you can find at http://www.servlets.com
along with a complete example of how to do, namely
http://www.servlets.com/jsp/examples/ch04/UploadTest.java .

I have had some problems using this class, it seems that it in some cases
doesn't upload the whole file, pure text files appears to create no problem.
I haven't yet identified the problem why it doesn't upload the whole file.
The problem exists even if the size of uploaded file is smaller than the
size specified in the receiving servlet.

Good Luck!


   /  Magnus




>From: David Wall <[EMAIL PROTECTED]>
>Reply-To: David Wall <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Uploading file to jsp/servlet
>Date: Sat, 24 Jul 1999 22:13:52 -0700
>
>Does anybody have any Java examples of processing an HTML form that
>includes a FILE as input?  My limited understanding is that the FORM
>ENCTYPE="multipart/form-data" needs to be set, but I'm unsure how to get at
>the file from my JSP/Servlet.
>
>I have a simple sample upload for a file, and I can easily get the form
>elements by name using the request.getParameterValues() method, but if you
>use that on the file element, you get the name of the file as it was called
>on the client's computer.  It doesn't have the file's contents.
>
>Then, I tried looking at the content-length, but it was small (only 87
>bytes in my case), so I know it is not showing the contents of the file
>either.  I suspect it has to do with the multi-part MIME file, and perhaps
>the servlet is only capable of handing a single-part form.
>
>How do I get at the FILE's contents that should have been uploaded?
>
>Thanks,
>David
>---------------------------------------------
>David A. E. Wall
>myEastside.com
>218 Main Street PMB 550
>Kirkland, WA 98033 USA
>Tel 425.822.4465    [EMAIL PROTECTED]
>Fax 425.822.4465    http://myEastside.com
>


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to