Hi ichy,

Thanks for your response. 

My html code is:

<form name="frmNTest" enctype="MULTIPART/FORM-DATA" method="post" 
action="test.jsp">
<input type=hidden name=hfrmID value="frmTest">
<input type=hidden name=hfrmActionID value="uploadFiletoServer">
<table width="98%" border=0>
<tr>
<td height=60><img src="/images/null.gif" height=15></td>
</tr>
<tr>
<td height=50><img src="/images/null.gif" height=15></td>
</tr>
<tr>
        <td>Select File</td>
        <td><input type="file" name="updfilename">
        </td>
</tr>

<tr>
        <td colspan="2"><div align="center">
        <input type="submit" name=Submit value="Upload">
        </div></td>
</tr>
</table>
*******************************

This is in test.jsp:

<%
UploadFile up = new UploadFile();
up.doUpload(request,response);
%>

***********************************

This is what I get in the ServletInputStream.


Content-Disposition:form-data; name= "hfrmActionID"   
  
  
    uploadFiletoServer      
  ----------------------------- 7d6106f7041a   
  Content-Disposition:form-data;name="lstReg"   
  test2   
  -----------------------------   7d6106f7041a   
  Content-Disposition:form-data;name="updfilename";filename="Test.xls"   
  Content-Type:application/vnd.ms-excel  
??????


I see a whole bunch of invalid characters and question marks and then I see the 
contents of the file, and then:

        -----------------------------7d6106f7041a 
        Content-Disposition:form-data; name="Submit"   
        Upload 
        -----------------------------7d6106f7041a-- 

*******************************

Now I am getting the exception:

2006.29.03 14:01:36 io error = java.io.IOException: Unable to read entire 
header; -1 bytes read; expected 512 bytes
  
thanks, AN


-----Original Message-----
From: ichy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 28, 2006 7:22 PM
To: POI Developers List
Subject: Re: JakartaPOI - read excel file using HSSF


hi, natu.

i haven't got a time to make test code to verify my opinion, but
post this message if it helps.

i assume request means HttpServletRequest.
have you tried to examine what is uploeded by looking at
the content of request.getInputStream() ?

if the html form is like below
-- html start -------
<form action="/servlet/UploadServlet" enctype="multipart/form-data"
method="POST">
<input type="hidden" name="submitter" value=username><br>
<input type="file" name="Uploaded file"><br>
<input type="submit" value="Send">
</form>
-- html end -------

then the content sent to server would be
-- content start ------
Content-Type: multipart/form-data; boundary=
---------------------------10265533117308
-----------------------------10265533117308
content-disposition: form-data; name="submitter"

username
-----------------------------10265533117308
content-disposition: form-data; name="Uploaded file"; filename="abc.xls"
[... contents ...]
-----------------------------10265533117308
-- content end -----

and in your case, the excel binary fo abc.xls is only the part
of [... contents ..]

usually people use some kind of framework or libray such as struts
not to take care of handling plain data sent by browser.

i hope this helps you.

regards
ichy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/

Reply via email to