If you want to write files relative to the root of the tomcat installation directory, you can find out what that is by calling System.getProperty("catalina.base").īut what ever you do, you need to make sure that a user can't accidentally or deliberately upload files to the wrong place e.g by supplying an absolute pathname, or a pathname that uses "././." to escape from your upload area. and because they are simply not the logical place. You shouldn't be dropping them in the bin or logs or lib or config directories because of the risk of interference. You shouldn't be dropping then in the webapp directory, because files there are typically blown away when the webapp is redeployed, and because there's a greater risk that uploaded files will interfere with your webapp. In a separate directory somewhere else in the file system. In a custom subdirectory of the Tomcat installation directory. which is where Tomcat conventionally puts transitory files such as compiled JSPs. The most interesting path of Tomcat is /manager/html, inside that path you can upload and deploy war files (execute code). So where should you be putting the files? (What happens if the user tries to upload a file whose name matches one of the scripts that live in "bin"?) And obviously the "bin" directory is an inappropriate place. You don't want them being stored in different places depending on how the web container is started. Obviously, putting them in the current directory is a bad idea. You should be making a conscious decision as to were uploaded files should be stored, and then making sure that the upload mechanism you are using puts them there. If so, you will find them, in whatever the current directory is when Tomcat is launched as a windows service.įrankly, I think you've got this wrong. Ultimately, it is what your application does that determines where the files are stored.īy the sounds of it, your application is storing files in the current directory of the JVM, which happens to be the "bin" directory when you launch the web server via NetBeans. Apache Tomcat Servlet / JSP Container Default Files (12085) 'Example JSPs and Servlets are installed in the remote Apache Tomcat servlet / JSP container.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |