aspose file tools*
The moose likes Servlets and the fly likes File Upload help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "File Upload help" Watch "File Upload help" New topic
Author

File Upload help

ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
Hi,

I am able to upload files through servlets. But the problem is my html form has several text fields apart from an upload field. Whenever I am using ENCTYPE="multipart/form-data" in my form..the file is getting uploaded but my request.getParameter() values are returning NULL.

Can anybody please help and let me know what I am supposed to change to make my application work with both uploading and returning the values keyed in by the user.

Thanks for the help.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

getParameter doesn't work with multi-part forms. You will need to check the documentation for whatever upload library you are using to see how to retrieve your form variables.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
Hi Ben Souther,

I am using com.oreilly.servlet.MultipartRequest for uploading my file. If possible can you please tell me what am I supposed to use instead of request.getParameter() for getting the values.

Thanks for the help.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You would need to check the documentation for those libraries.
I believe MultiPartRequest provides a getParameter() or similar method.

I haven't used the O'Reilly upload tool in years so I'm not sure how it works.
ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
Hi Ben Souther,

Thanks a lot..I will go through the documentation.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Second Notice.

"Ford Ford"-
Please adjust your displayed name to your real name as written in the
JavaRanch Naming Policy.

You can change it

here.

Thanks!

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
Hi,

I am able to upload files using servlets. But is there any way to restrict overriding of files and save using a different name ?

Thanks,
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

ford Jr,
Sorry to nag, but I don't think you're trying hard enough to create a convincing display name.

There's no way for us to realistically check the real name of each and every visitor to the site, so we tend to accept anything which sounds 'good enough', but you're not there yet. I can offer a bunch of alternatives: Ford Simpson, Ford Ponting, Ford Smithon. All these created without taxing my brain at all.

Please try again. Unfortunately it's sometimes easier to delete the account and start from scratch, but we hope it doesn't come to that.

thanks,
Dave.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: File Upload help