Skip to content

Commit

Permalink
[fix] #81 s3 주소 이동
Browse files Browse the repository at this point in the history
  • Loading branch information
myhyun0002 committed Feb 6, 2023
1 parent 5837f41 commit 2ac2e75
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -78,7 +79,7 @@ private Optional<File> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public List<String> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public ResponseTemplate<String> 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;
}

Expand Down

0 comments on commit 2ac2e75

Please sign in to comment.