Created
February 1, 2019 03:25
-
-
Save donma/8a710db8d71b95a8958352f563014848 to your computer and use it in GitHub Desktop.
Azure Blob Storage Upload Image File
This file contains hidden or 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 connsctionString = "your_connection_string"; | |
var cloudStorage = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(connsctionString); | |
var cloudBlobClient = cloudStorage.CreateCloudBlobClient(); | |
var cloudBlobContainer = cloudBlobClient.GetContainerReference("donmablogsample"); | |
var resultCreateContainer = cloudBlobContainer.CreateIfNotExistsAsync().Result; | |
Console.WriteLine("donmablogsample create already."); | |
Microsoft.WindowsAzure.Storage.Blob.CloudBlobDirectory cloudBlobDirectory = | |
cloudBlobContainer.GetDirectoryReference("TEST2/TEST21/IMAGES/"); | |
cloudBlobDirectory.GetBlockBlobReference("hamimelon.jpg").UploadFromFileAsync(AppDomain.CurrentDomain.BaseDirectory + "sample.jpg").GetAwaiter().GetResult(); | |
Console.WriteLine("Upload Success"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment