[prev in list] [next in list] [prev in thread] [next in thread]
List: jetspeed-user
Subject: web.xml and fileuploading
From: Anthony Smith <anthony.smith () fedex ! com>
Date: 2002-04-29 20:54:22
[Download RAW message or body]
I have a entry in my web.xml as follows:
<servlet>
<servlet-name>
DemoParserUploadServlet
</servlet-name>
<servlet-class>
gsptech.portal.servlets.DemoParserUploadServlet
</servlet-class>
<init-param>
<param-name>uploadDir</param-name><param-value>/temp/portal2/</param-value>
</init-param>
</servlet>
the uploadDir I am accessing in one of my servlets. Now if the temp/portal2
dir is already created it works fine. But I want to make my code where if it
no created then it goes and creats it. I cant seem to create the directory.
Here is the code in my servlet.
private File dir;
public void init(ServletConfig config) throws ServletException {
super.init(config);
// Read the uploadDir from the servlet parameters
String dirName = config.getInitParameter("uploadDir");
if (dirName == null) {
throw new ServletException("Please supply uploadDir parameter");
}
dir = new File(dirName);
dir.mkdir();
System.out.println("dir.mkdir();" + dir.isDirectory() + " dir:" +
dir);
if (! dir.isDirectory()) {
throw new ServletException("Supplied uploadDir " + dirName +
" is invalid");
}
}
***************************
Is till says dir.isDirectory() is false after dir.mkdir().
What am I doing wrong?
--
To unsubscribe, e-mail: <mailto:jetspeed-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-user-help@jakarta.apache.org>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic