commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <mart...@apache.org>
Subject Re: [FileUpload] How to get number of uploaded files from the request
Date Tue, 20 Apr 2004 16:02:51 GMT

"Julian Legeny" <jlegeny@abmira.sk> wrote in message
news:4085313E.6020304@abmira.sk...
> Thanks for advice. I have another question related to my problem.
>
> Is there possibility to know if ANY file was uploaded (before request
> is parsed)?

No, for exactly the same reason as I explained below.

--
Martin Cooper


> Thanks in advance,
> Julian
>
>
>
> Martin Cooper wrote:
>
> >I believe you're referring to the FileUpload component, and not the
> >FileUtils class within the IO component...
> >
> >It is not possible to find out how many uploaded files there are in the
> >request before parsing that request, since there is no "summary"
information
> >provided up front. It is only as the request is parsed that the
individual
> >items can be identified.
> >
> >An alternative approach for you might be to let FileUpload use its
default
> >repository, or your own default directory, and then move the files to
your
> >uniquely named directory after the request has been parsed. Note that as
> >long as the upload repository and your final directory are on the same
> >drive, the files will be moved rather than copied, so the operation is
> >inexpensive.
> >
> >--
> >Martin Cooper
> >
> >
> >"Julian Legeny" <jlegeny@abmira.sk> wrote in message
> >news:40839623.3010101@abmira.sk...
> >
> >
> >>Hello,
> >>   I would like to get number of uploaded files from the request.
> >>Reason:
> >>   When I use FileUtils I need to set up RepositoryPath before request
> >>is parsed.
> >>I'm generating unique directory (repository path) where the files will
> >>be uploaded to.
> >>But when there are no files uploaded but multipart-content is sent, the
> >>directory is
> >>always cretated and i need to delete it (it is bootless operation).
> >>My question is, if there is possibility to find out number of uploaded
> >>files before
> >>upload.parseRequest(hsrqRequest) is called. In this case I can skip to
> >>creating
> >>of RepositoryPath.
> >>
> >>Thanks for advice,
> >>Julian
> >>
> >>------------------------------- Code example
> >>// there is generated and created unique repository path
> >>
> >>String strRepositoryPath = generateRepositoryPath();
> >>
> >>// Create a new file upload handler
> >>upload = new DiskFileUpload();
> >>
> >>// setting of the repository path
> >>
> >>upload.setRepositoryPath(strRepositoryPath);
> >>
> >>// Parsing of the request
> >>
> >>lstRequestParameters = upload.parseRequest(hsrqRequest);
> >>
> >>-------------------------------
> >>
> >>
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
> >




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message