private String makeFolder(){
String str =
LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd"));
String folderPath =
str.replace("/", File.separator); //각기 다른 브라우저를 위한 구분자 교체
//make folder
File uploadFilePath = new File(uploadPath, folderPath);
if(uploadFilePath.exists() == false){
uploadFilePath.mkdirs();
}
return folderPath;
}
예시)
String path = uploadPath + File.separator + folderPath + File.separator + uuid+ "_" + fileName;
File클래스 생성자 | 설 명 |
---|---|
File(File parant, String child) | parent 객체 파일에 child 이름의 파일 객체를 생성한다. |
File(String parant, String child) | parent 폴더 경로에 child 이름의 파일 객체를 생성한다. |
File(String pathName) | pathName에 해당하는 파일 객체를 생성한다. |
File(URI uri) | uri 경로에 해당하는 파일 객체를 생성한다. |