Spring/오류 해결

[Spring 오류] Mac 파일 업로드 경로 오류 - java.io.FileNotFoundException

HSY_mumu 2022. 9. 6. 00:17
728x90

<상황>

application.yml 파일에서 업로드한 파일을 저장할 디렉토리 위치를 아래와 같이 설정했다.

custom:
  genFileDirPath: Desktop/temp/app10

 

<해결방법>

1. mac에서 디렉토리를 생성하기

 

2. 생성한 디렉토리 경로를 복사해 genFileDirPath 에 붙여넣기

- 2가지 방식이 있다(root 는 /Users/로 설정해주면 된다!!)

1) 해당 디렉토리로 이동 > 하단 디렉토리 우클릭 > 경로 이름 복사

2) cmd + i (파일 정보) > 위치 우클릭 > 경로 이름으로 복사

 

3. application.yml 파일의 custom.genFileDirPath 경로 수정

custom:
  # 업로드 파일 저장 경로
  genFileDirPath: /Users/hanseung-yeon/temp/app10

 

https://gaea.tistory.com/entry/%EB%A7%A5%EB%B6%81%EC%97%90%EC%84%9C-%ED%8C%8C%EC%9D%BC%EA%B2%BD%EB%A1%9C-%EC%84%A4%EC%A0%95-C%EB%93%9C%EB%9D%BC%EC%9D%B4%EB%B8%8C-D%EB%93%9C%EB%9D%BC%EC%9D%B4%EB%B8%8C

 

맥북에서 파일경로 설정 (C드라이브, D드라이브)

현재 작업중인 프로젝트에서 이미지 파일 업로드 기능을 추가했는데 팀원들이 다 윈도우 유저들이라 properties에서 이렇게 경로 설정을 해주었다. file.dir=C:/upload/ file.imageDir=C:/imageUpload file.regFil..

gaea.tistory.com

 

728x90