The HTML form does not actually submit the file, but only sends its name as a regular POST parameter:
which can be accessed using the first option:POST /myapp/SaveServlet HTTP/1.1
...
Content-Type: application/x-www-form-urlencoded
...
name=UPLOADME.txt
(in addition to getInputStream() and getReader()).Code: Select all
request.getParameter("name");
This happens because the form does not specify an enctype, and the default is application/x-www-form-urlencoded
To make the form upload the file it should have
Code: Select all
enctype="multipart/form-data"