views:

13

answers:

2

how to submit html elements text, hidden etc., along with file element?

While using multipart for file element, the other elements are not read, like request.getParameter("") gives me null for other text/hidden elements...

please help me in this with the solution...

Thanks. Narban.

A: 

<form enctype="multipart/form-data"... definitely does what you want.

oezi
He is already using `multipart/form-data`. His problem is that the other fields don't seem to be transmitted.
Pekka
A: 

Ensure that your other elements are inside the same form as your file input, and ensure that you have set the name attribute on all input elements you want to submit.

Deebster
MultipartParser mp; try { mp = new MultipartParser(request, 1*1024*1024); Part part; while ((part = mp.readNextPart()) != null) { String name = part.getName(); if (part.isParam()) { // it's a parameter part ParamPart paramPart = (ParamPart) part; String value = paramPart.getStringValue(); System.out.println("param; name=" + name + ", value=" + value); } } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }i could get all elements with this...thanks...
Narban