commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiaobo Yang" <xiaobo.y...@gmail.com>
Subject Re: [FileUpload] how to disable default output to server file system?
Date Wed, 07 Jun 2006 18:30:39 GMT
Thank you very much. - Xiaobo

On 6/7/06, Martin Cooper <martinc@apache.org> wrote:
>
> On 6/7/06, Xiaobo Yang <xiaobo.yang@gmail.com> wrote:
> >
> > 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
>
>
> It is only saved as a file if the size exceeds the configured threshold
> value.
>
> --
> Martin Cooper
>
>
> On 6/7/06, Martin Cooper <martinc@apache.org> wrote:
> > >
> > > On 6/7/06, Xiaobo Yang <xiaobo.yang@gmail.com> 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
> > > >
> > > >
> > >
> > >
> >
> >
>
>

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