You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Bruce Altner <ba...@hq.nasa.gov> on 2002/04/02 01:03:19 UTC
FileItem storeLocation
Greetings:
My application uses FileItem in a class which uploads a file from the
user's local drive to a remote server. It has always worked without a hitch
but recently was deployed on a box where the default storeLocation is
write-protected, so it fails. I am interested in being able to specify the
location where the tmp file is written to avoid this problem but
storeLocation is a protected field in FileItem and there is no accessor
method (that I could find). Do I have to write my own version of FileItem
or is there a way to set this using this class.
Here is how I am using FileItem:
FileItem fi = data.getParameters().getFileItem( "filename" );
InputStream ins = fi.getInputStream();
String fqFilename = fi.getFileName();
etc.
Thanks,
Bruce
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: FileItem storeLocation
Posted by John McNally <jm...@collab.net>.
The file is already written to the temporary location by the time you
have a FileItem, so it is too late to change it there. You need to
specify the path to FileUpload class, either with the setter or in the
parseRequest method. As it appears you are using this integrated into
ParameterParser, you would set it in TurbineResources.properties
#
# The directory where files will be temporarily stored.
#
services.UploadService.repository=/tmp
Note that the directory must exist. The service first checks that the
directory exists in the webapp directory, if not it assumes the path was
absolute.
john mcnally
Bruce Altner wrote:
>
> Greetings:
>
> My application uses FileItem in a class which uploads a file from the
> user's local drive to a remote server. It has always worked without a hitch
> but recently was deployed on a box where the default storeLocation is
> write-protected, so it fails. I am interested in being able to specify the
> location where the tmp file is written to avoid this problem but
> storeLocation is a protected field in FileItem and there is no accessor
> method (that I could find). Do I have to write my own version of FileItem
> or is there a way to set this using this class.
>
> Here is how I am using FileItem:
>
> FileItem fi = data.getParameters().getFileItem( "filename" );
> InputStream ins = fi.getInputStream();
> String fqFilename = fi.getFileName();
>
> etc.
>
> Thanks,
> Bruce
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>