E S wrote:
>
> Hello all,
>
> I've got an HTML form that allows users to upload files. However, I don't
> know the directory I want to save the file(s) to until I've parsed some of
> the form data (getting things like the userID, calculating next available
> fileID, etc.).
>
> I wanted to use Jason Hunter's MultipartRequest class, but it requires a
> directory parameter at the start, and I won't have a directory until after
> I've parsed the other non-file parameters.
>
> Also, since this is intended for a multiuser system, I don't think I want to
> just write everything to /tmp and then use the renameTo() to move it to the
> correct place afterwards--another user could upload a file with the same
> name immediately afterwards, and couldn't that potentially overwrite the
> first file?

You can
(a) create a different temp directory for each request, or
(b) use the com.oreilly.servlet.MultipartParser to walk the request
piece by piece.  The problem with piece-by-piece is there's no guarantee
the param(s) you want will come before the file(s).

-jh-

___________________________________________________________________________
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

Reply via email to