Skip to content

Commit

Permalink
[feat] S3 파일 업로드 시 폴더 경로 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
MinchoGreenT committed Sep 15, 2023
1 parent b818880 commit 8c040a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public BaseResponseDto<NewsCreateResponseDto> createNews(NewsCreateRequestDto re
}

public String uploadFile(MultipartFile file) {
return s3Service.uploadPdf(file);
return s3Service.uploadPdf(file, "news");
}

public ResponseEntity<byte[]> downloadFile(String key, String downloadFileName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public class S3Service {
@Value("${cloud.aws.s3.uploadPath}")
private String uploadPath;

public String uploadPdf(MultipartFile file) {
String key = UUID.randomUUID() + "_" + file.getOriginalFilename();
public String uploadPdf(MultipartFile file, String fileType) {
String key = fileType + "/" + UUID.randomUUID() + "_" + file.getOriginalFilename();

try {
ObjectMetadata metadata = new ObjectMetadata();
Expand Down

0 comments on commit 8c040a9

Please sign in to comment.