commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mart...@apache.org>
Subject Re: File Upload Usage Question
Date Tue, 03 Jan 2006 22:30:11 GMT
On 1/3/06, David Johnson <chachany@gmail.com> wrote:
>
> Oh well crap.
>
> Any ideas as to how I might do this? Would a good approach to be to try to
> incorporate the file into a form submission and then operate on it fom
> memory?


If, instead of getting the client to give you the path to the file, you get
the client to send you the file itself, then you can use FileUpload to parse
the request and then simply write() the appropriate file item to the desired
location. As for operating on it in memory, the default configuration of
FileUpload will keep the data in memory up to a certain threshold, and,
above that, write it to disk in a temp location. However, if you use write()
to get the file where you want it, you won't care about whether the file is
in memory or on disk (and if it's on disk, it will try to move the file
rather than copy it, so performance won't go down the drain unless you're
writing to a different drive).

--
Martin Cooper


ugh :(
>
> On 1/3/06, Martin Cooper <martinc@apache.org> wrote:
> >
> > On 1/3/06, David Johnson <chachany@gmail.com> wrote:
> > >
> > > Hi all
> > >
> > > I'm looking for a little guidance on the usage of fhe FileUpload
> > component
> > > to see if it can meet my needs on my application. Essentially, I have
> an
> > > application that (in the session) knows the location of a file which I
> > > Ideally would like to move to another "common" location, such as under
> > the
> > > web server itself.
> > >
> > > Does the file upload allow that sort of thing? The file itself isn't a
> > > part
> > > of the form, but I do have the file system location of the file..
> >
> >
> > Commons FileUpload can't help you if all you have is a path to the file,
> > and
> > in fact if the path is for the client machine, it's really of no use to
> > you.
> > (And if it's for the server machine, then you don't need an upload. ;)
> > FileUpload parses multipart requests, but those requests have to be made
> > by
> > the browser (using an <input type="file"> element) or some other client
> > such
> > as Commons HttpClient.
> >
> > --
> > Martin Cooper
> >
> >
> > Thoughts?
> > > --
> > > -Dave
> > > ChaChaNY@Gmail.com
> > >
> > >
> >
> >
>
>
> --
> -Dave
> ChaChaNY@Gmail.com
>
>

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