Hello!,
I have a form with the enctype=multipart/form-data
I need to upload a file but before i do that i need to get the paramters
from the text fields and validate the values if successful i need to call
the MultipartRequest class to do the actual upload.
The problem i am facing is that in the Upload.java servlet, doPost method i
am unable to get the values from the request object.
I have provided the code snippet
Upload.java
public class Upload extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
-- this returns a null
System.out.println ("The name is " + req.getParameter ("Name"));
MultipartRequest multi = new MultipartRequest(req);
-- now this gives a valid value
System.out.println ("the name is " + multi.getParameter("Name"));
}
}
The getParameter method is provided in the MultipartRequest class.
The problem is due to the "multipart/form-data" attribute. Can someone help
me out with this and tell me how i can get the information from the request
object before i call the multipartrequest class.
Thanks.
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets