From: "Caroline Jen" <[EMAIL PROTECTED]> > I am using the Struts to build a web application. I > am going to store some files (the files can be .doc, > .txt, .pdf, .jpg, whatever) on the server; e.g. > somewhere in my web application. > > Where is the proper and best place to store files? > $TOMCAT\webapps\MyApplication\???? > > Thanks for suggestions.
Are these part of the webapp at deployment time, or are they uploaded by users or otherwise created by the webapp at runtime? If you're just talking about static resources, graphics for your pages, etc., then anywhere other than under WEB-INF is visible to the browser, just make a sensible directory structure. If you're talking about run-time file creation or uploads... keep in mind that a webapp can run unexploded from a .war file... in that case you can't write to a directory within your webapp, because it doesn't exist. The Servlet container is required to provide you a place to put temporary files, though suspect that location isn't visible from a browser. Check the Servlet Specification for more info. If a database is out of the question, then just find somewhere in your file system that's visible to a browser, and write them there. I would configure the location you choose as a parameter in web.xml, so it's documented and can be changed easily. Do they need to be protected, or can anyone access them? In a later message, you mention putting them under WEB-INF as if you need to restrict access to them, so I'm not sure. Is this Tomcat-only or is Apache involved? We've used .htaccess to restrict access to files to only the IP address the request came from. HTH, -- Wendy Smoak --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]