• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to get all parameter's values from request when using multipart / form-data?

 
Ranch Hand
Posts: 111
Eclipse IDE Firefox Browser Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I’m retrieving vales from parameters in a multipart/form –data.
There is no problem when a parameter has only one value, but when a parameter has more than one value I 'm only able to get the first value.
Any idea?
Thanks.
 
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you tell me which parameter is having more then one value?

add the code snipet will be helpfull
 
Fernando Dominguez
Ranch Hand
Posts: 111
Eclipse IDE Firefox Browser Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello.
There is no problem in retrieving neither the file nor the form data, but when a form parameter comes with more than one value for example:
<input type="hidden" name="param1" value="A">
<input type="hidden" name="param1" value="B">

I'm only able to pick up the A

Thanks.
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you have same name for the both input tags we get only only the first value.

i suggest give different name for input tags
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check the API docs to see what getParameterValues(java.lang.String name) returns!
 
Fernando Dominguez
Ranch Hand
Posts: 111
Eclipse IDE Firefox Browser Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I' m afraid neither getParameter nor getParameterValues work with multipat / form-data.
This kind of form needs different treatment.
Thanks
 
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which API are you using to handle the multi-part form?
 
Greenhorn
Posts: 12
Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Fernando Dominguez,

The form data fields must contain unique names, or else when you access form data values you will get only top level values.
 
Bear Bibeault
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Anil Kumar Goud wrote:The form data fields must contain unique names, or else when you access form data values you will get only top level values.


That is not correct. It is perfectly valid for form to contain multiple elements with the same name, and all are submitted to the server. How the values are obtained is a matter of how the library being used parses the request body.
reply
    Bookmark Topic Watch Topic
  • New Topic