-
AWS S3 PresignedUrl Download프로그래밍 2025. 1. 14. 19:46
aws s3 presignedurl을 이용한 download시에, 특히 link download를 할 경우 다운로드가 아닌 브라우저에 그대로 노출되는 경우가 있다.
이럴 때 아래와 같이 처리하면 된다.
public async Task<string> GetDownloadUrl(string bucketName, string filename) { var request = new GetPreSignedUrlRequest() { BucketName = bucketName, Key = filename, Expires = DateTime.UtcNow.AddMinutes(10), ResponseHeaderOverrides = new ResponseHeaderOverrides { ContentDisposition = $"attachment; filename*=UTF-8''\"{WebUtility.UrlEncode(filename).Replace("+", " ")}\"" } }; return await _s3Client.GetPreSignedURLAsync(request); }
'프로그래밍' 카테고리의 다른 글
.net core에서 IServiceScopeFactory를 써야할 때 (0) 2025.02.07 Ant Design Blazor 소개 (0) 2025.01.07 MudBlazor 소개 (0) 2025.01.07 WPFUI 소개 (0) 2025.01.07 PDF를 구현해 보면서 느낀점. (1) 2025.01.07