on my form page, when I exclude enctype="multipart/form-data", I am able to read the parameters fine. but when I put it back.. I get error page (not any java error anyway, just IE error page). Below is the doPost:
Getting totally frustrated.. I see no sort of error anywhere but just nothign happens except for the IE error page. Please help
The request.getParameter() method (and related methods) will ony work when the form is encoded as a "normal" submission. It will not parse the request to obtain the parameters when you submit a multi-part form.
That's why 3rd party file upload packages are so popular (see FAQ). They handle parsing the request for the file upload and make the request params available through their API. [ September 12, 2007: Message edited by: Bear Bibeault ]
Servlets delay reading the body of a post until you call either the getServletInputStream method or one of getParameter, getParameterMap, getParameterName, or getParameterValues. Once it goes down one of those two paths, it can't back up and go down the other.
This makes sense when you think about it because all the methods in the second group would require a parsing of the entire stream to work. Since a file upload can be megabytes or gigabytes long, reading the whole thing and holding it in memory, isn't feasible.