tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ingvar Sigurður Alfreðsson <i...@ru.is>
Subject enctype=multipart/form-data
Date Wed, 11 Oct 2000 15:26:06 GMT
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




Mime
View raw message