You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ingvar Sigurður Alfreðsson <in...@ru.is> on 2000/10/11 17:26:06 UTC

enctype=multipart/form-data

Hello,

I can´t seem to get this to work!
When I call a servlet with enctype=multipart/form-data in the form tag then
the servlet doens´t recognize any of the parameters in the form !!!
What am I doing wrong ?

I wrote this short test program so you ´ll see what I´m trying to do:

<form action=http://localhost:8080/test/Tester method=post
encType=multipart/form-data>
<INPUT name=post_from>
<INPUT name=post_to>
<INPUT type=file name=post_file>
<INPUT type=submit value=Send name=submit>
</form>

and the servlet doPost method...

   protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws javax.servlet.ServletException, java.io.IOException
   {
      PrintWriter out = new PrintWriter (response.getOutputStream());
      response.setContentType("text/html");
      out.println("from:" + request.getParameter("post_from"));
      out.println("to:" + request.getParameter("post_to"));
      out.println("file:" + request.getParameter("post_file"));
      out.close();
   }

My result is: from: null to: null file: null

So I ask, have you got a clue why this is happening to me? What am I doing
wrong ?

Regards,
Ingvar Sigurður Alfreðsson
insa@ru.is




Re: enctype=multipart/form-data

Posted by Gregor Kovaè <gr...@mikropis.si>.
hi!

If you want to use multipart/form-data form type then you should use the 
little and excelent product that I found at
http://www.gjt.org/servlets/JCVSlet/log/gjt/org/gjt/vinny/servlet/

I hope you will use it with as much success as I have

best regards,
	kovi

P.S.: