Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Upload a BLOB to Azure Storage with a MIME type
using Microsoft.WindowsAzure.Storage;
using System.IO;
var account = CloudStorageAccount.Parse("YourStorageConnectionString");
var client = account.CreateCloudBlobClient();
var container = client.GetContainerReference(GetAzureContainerByFileType(type));
var blob = container.GetBlockBlobReference("myphoto.jpg");
blob.Properties.ContentType = "image/jpeg";
using(var file = File.OpenRead(@"c://path/to/myphoto.jpg")) {
blob.UploadFromStream(file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.