Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Upload a file to S3 (
HttpPostedFileBase file = Request.Files[0];
if (file.ContentLength > 0) // accept the file
string accessKey = "XXXXXXXXXXX";
string secretKey = "122334XXXXXXXXXX";
AmazonS3 client;
using (client = Amazon.AWSClientFactory.CreateAmazonS3Client(accessKey, secretKey))
PutObjectRequest request = new PutObjectRequest();
.WithKey("meals/test.jpg").InputStream = file.InputStream;
S3Response response = client.PutObject(request);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment