Skip to content

Commit

Permalink
[BE] 이미지 업로드시 임시 이미지 업로드 경로 지정 (Permission denied 에러 해결)
Browse files Browse the repository at this point in the history
배포 환경에서 이미지 업로드시 java.io.FileNotFoundException: images.jpeg (Permission denied) 에러 발생

경로를 명확하게 지정하여 에러 해결
  • Loading branch information
Jinwook94 committed Oct 19, 2023
1 parent 94ee70a commit 4b51222
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;

import static com.bootme.common.exception.ErrorType.*;

Expand Down Expand Up @@ -47,7 +46,7 @@ public String upload(AuthInfo authInfo, String imageType, MultipartFile imageFil
}

private File toFile(MultipartFile image) {
File file = new File(Objects.requireNonNull(image.getOriginalFilename()));
File file = new File("/tmp/"+image.getOriginalFilename());
try (FileOutputStream fos = new FileOutputStream(file)) {
fos.write(image.getBytes());
} catch (IOException e) {
Expand Down

0 comments on commit 4b51222

Please sign in to comment.