Thanks for your reply, Martin. In fact what I want to do is to simply save
uploaded file in a database. It is fine to retrieve the uploaded file as an
byte array in memory then save in the database. But it seems to be still
saved as a file automatically. - Xiaobo

On 6/7/06, Martin Cooper <[EMAIL PROTECTED]> wrote:

On 6/7/06, Xiaobo Yang <[EMAIL PROTECTED]> 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
>
>


Reply via email to