Hi,
1.- missing > at the end of <form ... >
2.- response.jsp must look like

 String sdata;
  String contentType = request.getContentType();
  String boundary =
contentType.substring(contentType.indexOf("boundary=")+9);
  if ((contentType != null) && (contentType.indexOf("multipart/form-data")
!= -1)) {
     try {
        ServletInputStream sis = request.getInputStream();
        int length = request.getContentLength();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        int c;
        for (int i = 0; i < length && (c = sis.read()) >= 0; ++i)
        {
          baos.write(c);
        }
        sis.close();
        sdata = baos.toString();
        baos.close();
        sdata = sdata.substring(sdata.indexOf("\r\n\r\n")+4);
        sdata = sdata.substring(0, sdata.indexOf("--"+boundary));
        data.setBytes(sdata.getBytes());
       } catch(Exception e) {
         error = e.toString();
       }



Eduardo.
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Ritesh Rawat
Sent: Friday, June 09, 2000 8:16 AM
To: [EMAIL PROTECTED]
Subject: File upload


Could any one tell how a clent can upload a file.

I tried to use
upload.htm"
///////
<form method=post action="response.jsp"
Enctype="multipart/form-data"
<input type="file" name="fname">
<input type=submit value="upload">
</form>
//////////
But it does not work.I could not get the content in
the parameter "fname". It shows me the null value


__________________________________________________
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to