[HttpPost]
public ActionResult Uploaddemo(HttpPostedFileBase file) {
try {
IAmazonS3 client;
using (client = Amazon.AWSClientFactory.CreateAmazonS3Client(_awsAccessKey, _awsSecretKey,RegionEndpoint.USWest2)) {
var request = new PutObjectRequest() {
BucketName = _bucketName,
CannedACL = S3CannedACL.PublicRead, ACCESIBLE
Key = string.Format("visumes/{0}", file.FileName),
InputStream = file.InputStream,//SEND THE FILE STREAM
};
Amazon.S3.AmazonS3Config s3Config = new Amazon.S3.AmazonS3Config() {
ServiceURL = "http://s3.amazonaws.com"
};
string HOST ="http://s3-website-us-west-2.amazonaws.com";
client.PutObject(request);
}
} catch (Exception ex) {
}
return View();
}