Tomcat 6文件上传策略 [英] Tomcat 6 file upload strategy

查看:138
本文介绍了Tomcat 6文件上传策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用tomcat,但仍然找不到上传文件的好方法。只是想知道你们如何处理文件上传。

I have been using tomcat for sometime and still can't find a good way to do file upload. Just wonder how you guys handle file upload.

你知道如何在应用程序中创建一个符号链接到另一个fs。但是默认情况下,tomcat会移除符号链接以及符号链接中的所有内容。所以这为自动部署添加了额外的步骤。我知道有补丁可以改变行为。但这会增加tomcat升级的额外步骤,补丁可能永远不可用。

You know how you can create a symlink in the application to another fs. but then by default tomcat removes your symlink and everything within the symlink. so this add extra steps to auto deployment. I know there are patch that you can change the behavior. but that will make add extra steps to tomcat upgrade, and patch might not be available always.

我使用fckeditor(带有它的servlet连接器),spring,struts 1/2有时只是文件上传的普通servlet。

I use fckeditor(with it's servlet connectors), spring, struts 1/2 and sometime just plain servlet for the fileupload.

最好的方法是什么?

另一个要求是,上传的文件应该是可查看的并且位置不错,这样备份脚本可以轻松备份,理想情况下不在应用程序内(或者只是应用程序中的符号链接) )

Another requirement is, uploaded file should be viewable and in a nice location so that backup script can backup easily, ideally not within the apps (or just a symlink within the apps)

欢迎任何评论!

=)

推荐答案

就个人而言,我将文件放在相对于$ CATALINA_BASE的位置:

Personally, I place the files in a location relative to $CATALINA_BASE:

文件目录=新文件(系统。 getProperty(catalina.base),uploads);

File dir = new File(System.getProperty("catalina.base"), "uploads");

这篇关于Tomcat 6文件上传策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆