Hi

I have a problem uploading files using jsps.

I have downloaded cos-27May2002.zip from the oreilly page at
http://www.servlets.com/cos/ which contains a set of utilities to do
file uploading. I installed the cos.jar file in my CLASSPATH and I can
access the classes.

However, I keep getting a strange error, namely:

"java.io.IOException: Posted content type isn't multipart/form-data"

In the jsp file where I enter my data I have the form set like this:

<form enctype="multipart/form-data" action="p_submitted.jsp">
<INPUT TYPE=FILE NAME=mydoc SIZE=40>
  <INPUT TYPE=SUBMIT VALUE=Submit>
</form><br><br>

And in the jsp file p_submitted.jsp, I get all the values out:

String project_ID = request.getParameter("project_ID");
and several other ones.

I also start a MultipartRequest object and tell it where to save things to:

MultipartRequest mr = new MultipartRequest(request,"/tmp/saved");

When I want to get the value from the upload field I do:

File uploadfile1 = mr.getFile(request.getParameter("mydoc"));

But this gives me the above error.

What am I doing wrong? Would anyone be able to tell me why I get the
error? Perhaps I am not using MultipartRequest right? If so, could you
someone me a simple code example on how to use MultipartRequest in a jsp?

Any help will be greatly appreciated.

Thanks

Hugo
--
Dr Hugo Bouckaert
Systems and Programming Engineer

GeoInformatics Exploration Australia P/L
57 Havelock St
West Perth, WA 6005
PO Box 1675, West Perth 6872

Ph:       61 08 9420 7400
Fax:      61 08 9226 1299

www.geoinformex.com

------------------------------------------------------------------------
This email and any attachments may be confidential or legally
privileged. If you received this message in error or are not the
intended recipient, you should destroy the e-mail message and any
attachments or copies, and you are prohibited from retaining,
distributing, disclosing or using any information contained herein.
Please inform us of the erroneous delivery by return e-mail. Thank you
for your cooperation.

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

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to