s3 upload base64 .net core
private static readonly string _awsAccessKey = ConfigurationManager.AppSettings["AWSAccessKey"];
private static readonly string _awsSecretKey = ConfigurationManager.AppSettings["AWSSecretKey"];
private static readonly string _bucketName = ConfigurationManager.AppSettings["Bucketname"];
public ActionResult UploadToS3(string base64String)
{
try
{
IAmazonS3 client;
byte[] bytes = Convert.FromBase64String(base64String);
using (client = Amazon.AWSClientFactory.CreateAmazonS3Client(_awsAccessKey, _awsSecretKey))
{
var request = new PutObjectRequest
{
BucketName = _bucketName,
CannedACL = S3CannedACL.PublicRead,
Key = string.Format("UPLOADS/{0}", file.FileName)
};
using (var ms = new MemoryStream(bytes))
{
request.InputStream = ms;
client.PutObject(request);
}
}
}
catch (Exception ex)
{
}
return View();
}
Also in C#:
- top down movement unity
- move towards target unity
- vb.net tostring numeric format string
- see if two string arrays are equal c#
- c# pass mouse events to parent
- c# add object to array
- uinput dialog uwp c#
- add row and columns to grid wpf in code
- unity atan value
- unity rigidbody constraints
- c# arraylist to listview
- c# count number of occurrences in string
- c# relaxed boolean cast
- dynamic convert type c#
- c# how to add newline on text box
- .net core copy file in folder to root
- snake game
- disable mouse unity
- c# multiple catch exceptions
- c# string replace comma with newline
- get absolute url c#
- c# one line set
- c# array.clone
- cshtml foreach