tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prabhakar, Achal" <APrabha...@Central.UH.EDU>
Subject RE: File upload directory
Date Tue, 06 May 2003 15:21:49 GMT
Dave,

I use the normal Java File IO facilities to access the files as such the
file path should be the
normal file system path. Taking your example, the file path would simply be
/images/Repository/image.jpg.
The relative path is only valid when you are using the container facilities.
Outside the container, as would be the case if you were to use the java.io
classes, you have to provide the real file system path.
The disadvantage is that you will have to serve the files yourself, but that
is not a very big deal.

I am not very sure if Tomcat will allow it, but if it does then you can
create a symlink within your webapp directory to the real path and let the
container serve the files for you.

-Achal


-----Original Message-----
From: Dave Neil [mailto:david.neil@ipaccess.com]
Sent: Tuesday, May 06, 2003 10:10 AM
To: Tomcat Users List
Subject: RE: File upload directory


Thanks Achal, follow on question -

I am storing the path to the file in the DB and storing the image in the
file system.

If the image is outside the webapp directory structure then what form should
the file path be to allow the HTML/JSP code to display the image.

For example the path / corresponds to the directory
/usr/share/tomcat4/webapps/mywebapp/
If I want the images in /images/Repository what should the file path be?
/../../../../images/Repository/image.jpg   ?

Dave.


> -----Original Message-----
> From: Prabhakar, Achal [mailto:APrabhakar@Central.UH.EDU]
> Sent: 06 May 2003 15:47
> To: 'Tomcat Users List'
> Subject: RE: File upload directory
>
>
> Dave,
>
> I have a similar application in which I put the uploaded images in a
> temporary staging area (/tmp). Once upload is complete and the application
> has performed the necessary checks, it moves to a separate directory,
> something like (/images/Repository).
>
> As far as I know, Tomcat does not put any restrictions on
> directory access,
> as long as the user under whom tomcat is running has permissions to access
> the files everything should be ok.
>
> -Achal
>
>
> -----Original Message-----
> From: Dave Neil [mailto:david.neil@ipaccess.com]
> Sent: Tuesday, May 06, 2003 9:32 AM
> To: tomcat-user@jakarta.apache.org
> Subject: File upload directory
>
>
> I am trying to determine the best location for a directory to contain
> uploaded images.
>
> Should it be to a subdirectory within the webapp performing the upload or
> should it go to a complete separate directory elsewhere on the server?
>
> Uploading the images into a directory under the deployment directory makes
> undeployment more difficult (removing the core of the web-app
> while leaving
> the uploaded images) and also appears to make it impossible to deploy as a
> war file.
>
> It seems logical to me that uploaded files should go to a
> separate directory
> on the server, but then
> I have the problem that I want to display the uploaded images from within
> the web-application. As I understand it, tomcat security prevents a
> web-application from accessing files outside the directory in which it has
> been deployed.
>
> Has anyone got any experience in this area?
> Thanks,
> Dave.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>


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

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


Mime
View raw message