File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes file uploading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "file uploading" Watch "file uploading" New topic

file uploading

rakesh gaddam

Joined: Jan 06, 2005
Posts: 15

I am trying to upload a file from a jsp page.I have used commons-fileupload package.

If I mention the enctype as multipart/form-data in my jsp page ,I am getting an IllegalArgumentException: argument type mismatch error.

If I remove the enctype as multipart/form-data from my jsp page, the method
isMultipartContent(request) is returning false with the error message:

the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded.

Can anyone help me with this.

Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
Are you trying to GET rather than POST as the method for the form?
rakesh gaddam

Joined: Jan 06, 2005
Posts: 15
I am using the method POST for the form.

Any idea as to what mistake I am making.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Here's some HTML code that I use for uploading files:And I am uploading to Commons Fileupload. But now that you mention it, I just installed version 1.1 of that product and it started giving me deprecation warnings about the isMultipartContent method. I didn't have any problems using the so-called deprecated method, but to make the warnings go away I eventually figured out to use this code:
I agree. Here's the link:
subject: file uploading
It's not a secret anymore!