Last active
September 21, 2020 02:09
-
-
Save scattered-code/acb74cb08bb0834b76803546891c9574 to your computer and use it in GitHub Desktop.
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
var storageAccount = CloudStorageAccount.Parse(_configuration["MicrosoftAzureStorage:AzureStorageConnectionString"]); | |
var backOffPeriod = TimeSpan.FromSeconds(2); | |
var blobClient = storageAccount.CreateCloudBlobClient(); | |
blobClient.DefaultRequestOptions = new BlobRequestOptions() | |
{ | |
SingleBlobUploadThresholdInBytes = 1024 * 1024, //1MB, the minimum | |
ParallelOperationThreadCount = 1, | |
RetryPolicy = new ExponentialRetry(backOffPeriod, maxAttempts: 5), | |
}; | |
var videoContainer = blobClient.GetContainerReference("videos"); | |
videoContainer.CreateIfNotExists(); | |
var blockBlob = _videoContainer.GetBlockBlobReference(filename); | |
blockBlob.Properties.ContentType = section.ContentType ?? "application/octet-stream"; | |
storedUrl = blockBlob.Uri.AbsoluteUri; | |
await blockBlob.UploadFromFileAsync(tempFilename); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment