Create a folder from Servlet and save file
Create a folder from Servlet and save file In my form, user uploads a photo(s) and then I want to store that photo in a network disk (in our local network). The following works fine, when I execute it from Netbeans in my PC: public void saveFiles(List<Part> fileParts,String targetId) { String pathRoot = "A:\ShareDisk1\Photos\"; String date = new SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance().getTime()); try { int counter = 1; for (Part filePart : fileParts) { String destPath = pathRoot + "\" + targetId; Boolean flag = new File(destPath).mkdirs(); System.out.println("flag = " + flag); File file = new File(destPath, targetId + " " + date + "-" + counter + ".jpg"); try (InputStream input = filePart.getInputStream()) { Files.copy(i...