반응형
//getRealPath() : 실제 톰캣이 돌아가고 있는 컴퓨터에서 그 곳의 절대 주소값
String rootPath = request.getSession().getServletContext().getRealPath("/");
//저장경로
1 String uploadPath = rootPath + "upload" ;
2 String uploadPath = request.getServletContext().getRealPath("/upload");
File path = new File("");
System.out.println(path.getAbsolutePath());
new File("").getAbsolutePath()+"/static/upload"반응형
'springBoot' 카테고리의 다른 글
| [SpringBoot] @requestBody list 혹은 array 받기 (0) | 2022.10.06 |
|---|---|
| springBoot email 전송 (구글 앱비밀번호 발급) (0) | 2022.09.14 |
| [Spring Boot] Spring Security + JWT token 로그인 (0) | 2022.09.06 |
| [ SpringBoot ] api test , jpa test 코드 (0) | 2022.08.19 |
| springBoot + react (0) | 2022.05.06 |
댓글