My form has <input type="file">
and other html controls. I am able to upload the file to the server. However when I tried to request.getParameter("phone");
It will output phone = null.
When I remove enctype="multipart/form-data"
, I am able to get phone. However, upload file does not work.
How can I get phone parameter and upload file work together?
Help will be appreciate and thanks in advance! :)
Below are my codes.
In jsp
<FORM NAME="InputForm" ACTION="servletname" METHOD="POST" enctype="multipart/form-data">
<P><input type="text" name="phone">
<P><input type="file" name="filename">
<P><input type="submit" value="Upload File">
</FORM>
In SERVLET
String phone = request.getParameter("phone");