Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mutipart/form-data

 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have html form element with ENCTYPE="MULTIPART/FORM-DATA"
that is

I couldn't able to read the values of the parameter action,id using request.getParameter(..) method,
please tell me how to capture that values ?
Regards
Balaji
 
George Joseph
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Balaji,
In case of MULTIPART/FORM-DATA the request parameters can only be read after saving the file, using JspSmartUpload or other 3rd Party softwares.

But if you need to read values before saving the file then there is one tricky method. Set all the parmeters as query string which you need to access using request.getParameter("parma#").
Note for this you must change your form action as
"servlet/controllerServlet?param1=value1&param2=value2&param3=value3"

Hope this will answer your query.

George Joseph,
Product Development Group,
Transversal e Networks
[ November 08, 2002: Message edited by: George Joseph ]
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by George Joseph:
Hi Balaji,
But if you need to read values before saving the file then there is one tricky method. Set all the parmeters as query string which you need to access using request.getParameter("parma#").
Note for this you must change your form action as
"servlet/controllerServlet?param1=value1&param2=value2&param3=value3"
George Joseph,
Product Development Group,
Transversal e Networks
[ November 08, 2002: Message edited by: George Joseph ]

Unfortunately!. Its not possible for my case where i have to get the input typed by the user.
In my case the user will select a particular language,then type his/her id,then select the file to upload.
Please help with this scenario ?
Regards
Balaji
 
George Joseph
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Balaji Loganathan:

Unfortunately!. Its not possible for my case where i have to get the input typed by the user.
In my case the user will select a particular language,then type his/her id,then select the file to upload.
Please help with this scenario ?
Regards
Balaji


Hi Balaji
Then you will have to use JspSmartUpload or other 3rd Party softwares.
You can download JspSmartUpload from JspSmart
The code is something like this


George Joseph,
Product Development Group,
Transversal e Networks
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks George,
It did the job finely.
thanks again.
Regards
Balaji
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic