commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <>
Subject Re: [FileUpload] how to disable default output to server file system?
Date Wed, 07 Jun 2006 16:29:44 GMT
On 6/7/06, Xiaobo Yang <> wrote:
> Hi,
> I noticed that if I do not write the uploaded file by myself as a file on
> server file system. A file will be saved by default using the name
> upload_xxx.tmp. I wonder how to disable this function as I do not want to
> save the file on the server. Thanks.

Do you want to always keep the file in memory, regardless of size, or do you
want to store large uploads somewhere other than on the disk? In the former
case, you have three options:

1) Set the size threshold on the file item factory to a very large number,
so that the threshold is never reached.

2)  Subclass DiskFileItem and reimplement getOutputStream() so that it
always writes to memory.

3) Write your own FileItem implementation. (This doesn't really make a lot
of sense for what you want todo, though.)

Regardless of which of these you use, I would encourage you to set a
meaningful limit on sizeMax, so that you don't run out of memory on the
server if people start trying to upload large items.

If you want to write the data somewhere other than the disk (or memory),
you'll need to write your own FileItem implementation.

Martin Cooper

Xiaobo Yang

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message