I use AWS.Net to upload custom content (images) and display it on my site. This is what my code currently looks like for download:
using (client = Amazon.AWSClientFactory.CreateAmazonS3Client())
{
var putObjectRequest = new PutObjectRequest
{
BucketName = bucketName,
InputStream = fileStream,
Key = fileName,
CannedACL = S3CannedACL.PublicRead,
//MD5Digest = md5Base64,
//GenerateMD5Digest = true,
Timeout = 3600000 //1 Hour
};
S3Response response = client.PutObject(putObjectRequest);
response.Dispose();
}
What is the best way to keep the path to these files? Is there any way to get the link to my file from the response?
Currently, I only have the URL of my webconfig, for example https://s3.amazonaws.com/<MyBucketName>/, and then when I need to show the image, I take this line and use the key from the object, which is stored in db, which represents the downloaded file.
Is there a better way to do this?
, , . , , SDK, Amazon.