Jeff Brekke wrote:
 
> Question: We would then be responsible for reading the input stream and
> writing to the physical disk, or this would already be done for us and the
> FileItem.getStream() method would return a stream to the file on disk ( or in
> memory )?

> What we are doing is determining where the files go physically when uploaded.
> We create a directory and place the files in the new directory in some cases,
> others we use an existing directory, etc.  How would we accomplish this with
> your proposed system.  With the oreilly uploader, we just configure the upload
> path, instaniate the uploader, and let it put the file there.

I have the following approach to this problem:

- User choses files and submits the form.
- Auto uploader gets the files from the POST stream and stores them in temporary
  location (an array in memory for small files, temporary file on the disk for big 
ones). 
- An action gets FileItems from the Parameter parsers, checks permissions, file sizes
  (a request exceeding maximum size would be rejected and result with no FileItems)
  determines file locations (original names are available via FileItem.getFileName)
  then reads the stream, and stores it to final location, or just ignores the FileItem
  that will go away (possibly delete temp file) at the end of request processing.

It's a clear disadvantage that files that you must do an extra read/write of the file 
to
put it in the final location, but this aproach deals consistently with large requests
without keeping them in memory as a whole (I believe that memory is the most valuable
resource of a busy webserver). It also gives your action access to ordinary
form fields values before it decides to accept the files or reject them.

> So, to answer my question, we'd have all uploaded files going to the same
> directory?  What if two users upload the same filename?

The files are assigned temporary names that do not clash. It's all invisible to
your aplication.

> Yes, it is!  Just what we needed here!  I'll attempt to be as much help as
> possible....

Good! I have no experience with writing applets, so I'd be glad if you took care
of that. Just read the RFC - creating multipart/form-data and multipart/mixed
is easy. I think that you may encounter problems with security here - I believe that by
default browsers don't allow applets to read files from the disk, so using this
applet would require the user to tweak his configuration.

Regards, Rafal


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to