wood burning stoves 2.0*
The moose likes JSP and the fly likes File upload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "File upload" Watch "File upload" New topic

File upload

Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315

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.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

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.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
hassan ali
Ranch Hand

Joined: Apr 23, 2006
Posts: 127
try this one

[BSouther: Added UBB CODE tags]
[ August 27, 2007: Message edited by: Ben Souther ]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

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?
I agree. Here's the link: http://aspose.com/file-tools
subject: File upload
Similar Threads
JSP throwing null pointer exception the first time I run it
choose the servlet a form should do
Seats class in the business domain model
Problem with view while using JSF with Tiles
Submitted Form values are repeated across