This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Upload file and fetch other parameters as well...

 
Mandy S Smith
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using oreilly's MultiPartRequest class to upload file on to server. I have a form which has browse button with text field to upload the file and as well as some text fields that i need to fetch their values along with this upload stuff.
As i have this ENCTYPE = multipart/form-data attribute in my <FORM> tag, its not allowing me to fetch other text field values at all. Is there a way that i acheive this ie fetch both the text field values as well as the file name to be uploaded.
Appreciate your help.
I would greatly appreciate if anyone can respond.
Thank you.
 
Parag Shah
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using O'Reilly's Multipart Request, you must use their MultipartParser class to read the other parameters. I have used it succesfully a long time back. You will have to check the API of MultipartParser.java to instantiate and use it.
Hope it helps.
Parag
 
Mandy S Smith
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, i already found out and have implemented using MultiParser and i am able to fetch all the parameters.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's possible to get other request parameters from the MultipartRequest class. You just have to use it correctly.
 
Sunny Liu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mandy,
check this http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=7&t=007605
You can use my class to get parameter and files.
Once you construct HttpUploader with request and response. you will be able to use HttpUploader just like request object.
I wish it will help you out.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic