File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Upload help

 
ford Darcy Jr
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
ford Darcy Jr
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ben Souther,

Thanks a lot..I will go through the documentation.
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
ford Darcy Jr
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic