Tomcat 6 file upload strategy

那年仲夏 提交于 2020-01-13 18:17:20

问题


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.

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.

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

What is the best way to do this?

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)

Any comment is welcome!

=)


回答1:


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

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



来源:https://stackoverflow.com/questions/1047263/tomcat-6-file-upload-strategy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!