This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services | |
.AddSingleton<IAmazonS3>(p => { | |
var config = new AmazonS3Config | |
{ | |
RegionEndpoint = RegionEndpoint.USWest2, | |
}; | |
return new AmazonS3Client(myAccessKey, mySecret, config); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (p.GetService<IHostEnvironment>().IsDevelopment()) | |
{ | |
config.ForcePathStyle = true; | |
config.ServiceURL = "http://localhost:4566"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services | |
.AddSingleton<IAmazonS3>(p => { | |
var config = new AmazonS3Config | |
{ | |
RegionEndpoint = RegionEndpoint.USWest2, | |
}; | |
if (p.GetService<IHostEnvironment>().IsDevelopment()) | |
{ | |
config.ForcePathStyle = true; | |
config.ServiceURL = options.Url; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<IActionResult> Upload([FromServices] IAmazonS3 s3) | |
{ | |
await new TransferUtility(s3) | |
.UploadAsync(source, "my-bucket", "some/path/image.jpg"); | |
return Ok(); | |
} |
OlderNewer