Of course if you need to upload files - then you'll need to rely on the tmpdir as defined in the spec.
(Section 3.7:
java.io.File dir = (java.io.File)
servletContext.getAttribute("javax.servlet.context.tempdir");)
Or you'll need a configuration parameter that an admin may set. (And you read in via JNDI)
-Tim
Julie McCabe wrote:
Hello,
My setup is Tomcat 4.1.27, Java 1.4.2_02, Red Hat Linux 9.0.
I have a JSP located in the webapps directory I would like it to read a file in the WEB-INF directory using a custom tag, eg,
File f = new File("WEB-INF/fileToRead.txt");
depending on which directory I start tomcat from the file will be located on not - if I start tomcat from the $CATALINA_HOME directory it will work but if I start tomcat from $CATALINA_HOME/webapps/webApp directory it will not pick up the file because the location is wrong! I thought the code in the JSP should work regardless of which directory tomcat is started from.
In addition, I have noticed the behaviour of the
<input type="file" is incorrect too
In the JSP with this tag, I am able to browse to the correct file but when the upload is attempted I get a FileNotFoundException because it is looking for $CATALINA_HOME/fileToUpload.txt - it ignores the path selected.
I am guessing this is a classpath problem or an environment variable that is set when tomcat is started - I would appreciate any ideas on this.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]