From 2ac2e7508ab84d9af6966a30978e4942302b02bd Mon Sep 17 00:00:00 2001 From: myhyun0002 Date: Tue, 7 Feb 2023 00:36:21 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20#81=20s3=20=EC=A3=BC=EC=86=8C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/umc3_teamproject/repository/S3Uploader.java | 3 ++- .../com/example/umc3_teamproject/service/ForumService.java | 2 +- .../service/InterviewParagraphResultService.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/example/umc3_teamproject/repository/S3Uploader.java b/src/main/java/com/example/umc3_teamproject/repository/S3Uploader.java index 4dac3d6..66e27b1 100644 --- a/src/main/java/com/example/umc3_teamproject/repository/S3Uploader.java +++ b/src/main/java/com/example/umc3_teamproject/repository/S3Uploader.java @@ -38,6 +38,7 @@ public class S3Uploader { private String region; public String upload(MultipartFile multipartFile, String dirName) throws IOException { + System.out.println(multipartFile.getName()); File converted_to_File = convert(multipartFile) .orElseThrow(() -> new IllegalArgumentException("MultipartFile -> File로 전환이 실패했습니다.")); return upload(converted_to_File, dirName); @@ -78,7 +79,7 @@ private Optional convert(MultipartFile file) throws IOException { public void deleteFile(final String deleteFileName) { // 나중에 s3 주소가 변경될 시에 bucket 이름을 바꿔줘야 하니 여기를 바꿔주면 됩니다. - String fileName = "forumImage/" + deleteFileName; + String fileName = "image_video_record/" + deleteFileName; System.out.println(bucket); System.out.println(fileName); amazonS3Client.deleteObject(bucket,fileName); diff --git a/src/main/java/com/example/umc3_teamproject/service/ForumService.java b/src/main/java/com/example/umc3_teamproject/service/ForumService.java index 1e15c4f..9f2c3ee 100644 --- a/src/main/java/com/example/umc3_teamproject/service/ForumService.java +++ b/src/main/java/com/example/umc3_teamproject/service/ForumService.java @@ -121,7 +121,7 @@ public List uploadImageToForum(ForumRequestDto.createForumRequest postRe return postRequest.getImageFiles().stream() .map(image -> { try { - return s3Uploader.upload(image, "forumImage"); + return s3Uploader.upload(image, "image_video_record"); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/src/main/java/com/example/umc3_teamproject/service/InterviewParagraphResultService.java b/src/main/java/com/example/umc3_teamproject/service/InterviewParagraphResultService.java index ac122fa..35d4d40 100644 --- a/src/main/java/com/example/umc3_teamproject/service/InterviewParagraphResultService.java +++ b/src/main/java/com/example/umc3_teamproject/service/InterviewParagraphResultService.java @@ -103,7 +103,7 @@ public ResponseTemplate createInterviewResult(Long interviewParagraph_id @Transactional public String uploadImageToInterviewParagraphResult(MultipartFile voiceFile) throws IOException { - String voice_url = s3Uploader.upload(voiceFile, "forumImage"); + String voice_url = s3Uploader.upload(voiceFile, "image_video_record"); return voice_url; }