All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
Hello,
I will wish to clarify the following properties : - StorageClass - ServerSideEncryptionMethod - CannedACL I do not see how, thank you for your help. Vincent
using
Amazon.S3;
Amazon.S3.Model;
System;
System.Collections.Generic;
System.Collections.Specialized;
System.Linq;
System.Web;
Telerik.Web.UI;
namespace
MyNamespace
{
public
class
CustomAmazonProvider : AmazonS3Provider
override
void
Initialize(
string
name, System.Collections.Specialized.NameValueCollection config)
AccessKey =
"{ACCESS_KEY}"
;
SecretKey =
"{SECRET_KEY}"
BucketName =
"{BUCKET_NAME}"
UncommitedFilesExpirationPeriod = TimeSpan.FromHours(2);
}
UploadFile(
keyName, System.Collections.Specialized.NameValueCollection metaData, System.IO.Stream fileStream)
PutObjectRequest request =
new
PutObjectRequest() { Key = keyName, BucketName = BucketName, InputStream = fileStream };
request.CannedACL = S3CannedACL.PublicRead;
foreach
(
key
in
metaData)
request.Metadata.Add(key, metaData[key]);
try
AmazonS3Client.PutObject(request);
catch
(AmazonS3Exception e)
var message =
.Format(
"Exception thrown for upload operation for file with keyName: {0}"
, keyName);
throw
CloudUploadProviderException(message, e, keyName, BucketName);
InitiateMultiPartUpload(
keyName, NameValueCollection metaData)
InitiateMultipartUploadRequest request =
InitiateMultipartUploadRequest();
request.BucketName = BucketName;
request.Key = keyName;
InitiateMultipartUploadResponse response;
response = AmazonS3Client.InitiateMultipartUpload(request);
CloudUploadProviderException(
"Exception thrown for initiate multi part upload operation"
, e);
return
response.UploadId;