I just read this great answer from BalusC about how to upload files with the 3.0 Servlet API.
My question is about the use of request.getParameter()
for common fields. For example, if my form looks like this :
<form action="/upload" method="post" enctype="multipart/form-data">
<fieldset>
<label for="description">File description:</label>
<input type="text" id="description" name="description" value="" />
<label for="uploadedFile">File:</label>
<input type="file" id="uploadedFile" name="uploadedFile" />
<input type="submit" value="Send" />
</fieldset>
</form>
Following what BalusC explained, I should manipulate the InputStream returned by part.getInputStream()
to get the content of the description field. Why is that ? I tried to simply call request.getParameter("description")
, and it seems to work fine.
I use Tomcat 7.0.20.
Thanks for your help.