I notice that in your sample code form there is no "project_ID" <input>
field, yet you are able to retrieve this as a parameter in your JSP
processing page?

Do you perhaps have two forms on your page, one with the file <input> and
one with other <input> fileds? If so, then this is your problem as only one
of the forms and its <input> fields gets submitted.

The explanation of error message would then be that the second form is not
"multipart/form-data".

To solve your problem, merge both forms into one, make sure it has
"multipart/form-data" as the enctype.

Cheers mate.

> -----Original Message-----
> From: hugo [SMTP:[EMAIL PROTECTED]]
> Sent: 27 September 2002 10:56
> To:   [EMAIL PROTECTED]
> Subject:      error using MultipartRequest: content type isn't
> multipart/form-data
>
> 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
--

It is the strict policy of Truworths that its e-mail facility and all
e-mail communications emanating therefrom, should be utilised for
business purposes only and should conform to high professional and
business standards.   Truworths has stipulated certain regulations in
terms whereof strict guidelines relating to the use and content of
e-mail communications are laid down. The use of the Truworths e-mail
facility is not permitted for the distribution of chain letters or
offensive mail of any nature whatsoever.   Truworths hereby distances
itself from and accepts no liability in respect of the unauthorised
use of its e-mail facility or the sending of e-mail communications
for other than strictly business purposes.   Truworths furthermore
disclaims liability for any  unauthorised instruction for  which
permission was not granted.    Truworths Limited accepts no liability
for any consequences arising from or as a result of reliance on this
message unless it is in respect of bona fide Truworths business for
which proper authorisation has been granted.

Any recipient of an unacceptable communication, a chain letter or
offensive material of any nature is requested to notify the Truworths
e-mail administrator ([EMAIL PROTECTED]) immediately in order that
appropriate action can be taken against the individual concerned.

===========================================================================
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