问题
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