Example #1
0
        public async Task <string> Add(FileUse fileUse, string fileId, string contentType, Stream stream)
        {
            string s3Key            = FileServiceUtilities.GetKey(fileUse, fileId);
            var    putObjectRequest = new PutObjectRequest
            {
                BucketName      = _s3Config.BucketName,
                Key             = s3Key,
                InputStream     = stream,
                ContentType     = contentType,
                CannedACL       = S3CannedACL.Private,
                AutoCloseStream = false
            };

            await _retryPolicy.ExecuteAsync(() => _s3Client.PutObjectAsync(putObjectRequest)).ConfigureAwait(false);

            return(FileServiceUtilities.GetCdnFileUrl(_s3Config.CdnUrl, s3Key));
        }
Example #2
0
 public string GetCdnUrlFromFileKey(string fileKey)
 {
     return(FileServiceUtilities.GetCdnFileUrl(_s3Config.CdnUrl, fileKey));
 }