> <FORM ACTION="/servlets/upTest" ENCTYPE="multipart/formdata"
It's "multipart/form-data". The dash matters.
> String path = req.getParameter("savepath")
This will very likely cause the server to read all the POST data looking
for the savepath parameter. (Exact behavior depends on the server; some
are smart enough not to read post data whose content type they don't
know.) The server won't find the parameter, of course, since it doesn't
understand multipart/form-data, but the POST data will be read and gone
nevertheless.
Then when MultipartRequest tries to read the data, it can't. That's why
it's reporting a premature ending of the input.
When reading a multipart request you can't call getParameter() first.
There's not even a way to read a parameter from the form data and use
that parameter's value in deciding the directory. Everything gets read
and saved in one fell swoop. Allowing what you want would be a serious
pain in the code.
My suggestion is to construct a MR saving files to a unique temp dir,
then read the location parameter and just move the files to the
appropriate dir. Much, much easier than trying to incrementally parse
the input. In fact, there's no guarantee the browser will send the
location parameter ahead of the file itself! Since you can't guarantee
that, you have to go this way.
Good luck,
-jh-
--
Jason Hunter
[EMAIL PROTECTED]
Book: http://www.servlets.com/book
Article: http://www.javaworld.com/jw-12-1998/jw-12-servletapi.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html