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

File upload

 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have put enctype="multipart/form-data" in my form.

but still I am able to get the form element using the request.getParamter()

I am not sure, if it should work like this.. it should have returned null

please provide some inputs.

Thanks,
Neeraj.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Multipart requests work differently.
request.getParameter doensn't work with them.

You will need to read the documentation for whatever upload libraries you're using to learn how to retrieve form parameters.

If you're not yet using an upload library, there is a section in the JSP FAQ on uploading that lists some of the more popular ones.
 
hassan ali
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this one





[BSouther: Added UBB CODE tags]
[ August 27, 2007: Message edited by: Ben Souther ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hassan ali,
Two things.
Please, if you are going to post code (especially a lot of code) to the forums, use UBB Code tags. Nobody wants to read large dumps of unformatted code. I've added them to your post for you.

Also, the original poster wasn't asking how to parse an entire multi part upload himself. He was asking about retrieving form parameters. Most of us are using third party libraries for handling mulipart uploads these days.

Out of curiosity, why are you doing this yourself?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic