mkdir() doesn't work in Dynamic Web Project

Viewed 29

I'm trying to upload files using a servlet, which creates a new directory and insert the file into that. Now I'm trying to create the directory, but the problem is that the path doesn't match. Can you help me?

String path="imageProdotto"+File.separator+"test";
String finalPath =getServletContext().getRealPath("")+ path;

File uploadDir = new File(finalPath);
if(uploadDir.mkdir())System.out.println("ok");
else System.out.println("no");

So, when Servlet is called, mkdir() return false.

0 Answers
Related