Is it really a deficiency in the com.oreilly.servlet code?

The COS library provides MultipartParser to do all the heavy lifting
parsing work.  As a convenience there's the MultipartRequest
fairly-trivial front end that takes a directory in its constructor and
saves the uploaded files there.  If you want some other front end,
providing things like overwrite handling or saving different files to
another location, you can write another front end basing on the MR
code.  I see that's what you did; you wrote a front end to read the
files into memory and avoid the filesystem.

But to be honest, I'm going to need to be convinced it's necessary.
I've let MR write the files to a temp directory and then let the web app
move them to the appropriate "golden" location.  The web app can enforce
the business logic on how it want to deal with conflicts (like newer
file wins or original file wins or file gets renamed or whatever).  That
also saves you from ever having partial uploads in the "golden"
location.  A file move on the same filesystem is an extremely fast
operation compared to the upload, so no slowdown.  It also solves the
problem where you need to change the location based on a parameter,
since there's no guarantee the parameter will come before the files in
the upload stream.

I could provide a class that had built-in handling for overwrites, but
is there an agreed-upon way?  Old wins, new wins, or rename?  And if
rename, how shall we rename?

-jh-

Jeff Schnitzer wrote:
>
> This is actually a very serious deficiency in the O'Reilly code, and
> pretty much makes it unusable for anything other than a toy website.
> Basically, if two people simultaneously upload files with the same name,
> horrible things happen.

___________________________________________________________________________
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