Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

file uploading

 
rakesh gaddam
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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.

Thanks
Rakesh.
 
Maximilian Xavier Stocker
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to GET rather than POST as the method for the form?
 
rakesh gaddam
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the method POST for the form.


Any idea as to what mistake I am making.

Thanks
Rakesh.
 
Paul Clapham
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic