tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konrad Kaminski <konrad.kamin...@xorsol.com.pl>
Subject RE: enctype=multipart/form-data
Date Wed, 11 Oct 2000 16:59:01 GMT
Read 5.1 point in Servlet 2.2 specification.

getParameter works only for application/x-www-form-urlencoded content types.

Konrad mailto:konrad.kaminski@xorsol.com.pl

-----Original Message-----
From: insa@ru.is [mailto:insa@ru.is]
Sent: Wednesday, October 11, 2000 5:26 PM
To: tomcat-user@jakarta.apache.org
Subject: 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



Mime
View raw message