[That is, given the form: <FORM ACTION="/servlet/FooServlet" ENCTYPE="multipart/form-data" METHOD=POST>
What is your name? <INPUT TYPE=TEXT NAME='submitter'><br>
What file are you sending? <INPUT TYPE=FILE NAME=secretDocument><br>
<input type="submit" value=Submit><br>
</FORM>
I cannot read the submitter using request.getParameter("submitter") (it returns null). ] Situation:
javax.servlet.HttpServletRequest.getParameter(String) returns null when the ContentType is multipart/form-data
Paulo Pontes
Greenhorn
Joined: Dec 06, 2004
Posts: 20
posted
0
the standard classes supplied by sun does not suport multipart/form-data (file transfer forms) give a look at jakarta commons and you will find a set of classes to make file transfer servlets.
my problem is not to upload the file....its how to get the value of other fields such as textbox input from a form where one field is for file upload. request.getparameter returns null. and if i dont use multipart/form-data then i wont b able to upload the file.. so please tell me the solution to get the value of text fields in servlet. as request.getparameter() doesn't work. !! i am uploading a file from the same form. so i ll have to use multipart/form-data.....
Right, Use the commons/fileupload tool that I showed you. It provides methods for retrieving your parameters. getParameter doesn't work with mulit-part forms.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.