Dear all,

     I know this isn't a new question and I had gone through the archive
but couldn't find an answer.

     I basically used the com.oreilly.servlet.MultipartRequest method
as suggested by many. The servlet and html code are
exactly the same as UpLoadTest.html and UpLoadTest.java that I downloaded
from Servlets.com, of courser I had changed the URL to the proper one.
I use jswdk-1.0.1 as web server, Netscape 4.73 as browser, jdk1.2.1 to
compile the servlet and Window95 environment. The error which after
running the html to send files is
   "Network error occured while Netscape was receiving data.
     (Network error: Connection reset by peer)
     Try connection again "

     I had tried sending a string (use <input...> without
ENCTYPE="multipart/form-data")  to the servlet and servlet receiving it
the normal way PrintWriter out = PrintWriter(resp.getOutputStream()); ...
without MultipartRequest and it worked.

     I also tried
<FORM
      action="mailto:[EMAIL PROTECTED]"
      enctype="multipart/form-data"
      method="post">  to send files through email to myself, that also
worked.

      But when I tried sending files using MultipartRequest the server
wouldn't connect and I got the above mentioned error.  In the html, I do

 <FORM
   ACTION="http://100.89.67.121:8080/servlet/tll.fileinputTest"
   ENCTYPE="multipart/form-data"
   METHOD=POST>
   Which file do you want to upload? <INPUT TYPE=FILE NAME=file>
   <INPUT TYPE=SUBMIT>
</FORM>

 and in the servlet
 ...
 MultipartRequest multi =
        new MultipartRequest(req, ".", 5 * 1024 * 1024);

      // Print the parameters we received
      Enumeration params = multi.getParameterNames();
      while (params.hasMoreElements()) {
        String name = (String)params.nextElement();
        String value = multi.getParameter(name);
        out.println(name + " = " + value);
      }
    ......

     Any suggestions? Thanks in advance.


Regards,

Le Cheng

___________________________________________________________________________
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