There are a couple of ways. The easier way is to just use /
characters as @makerofthings7 already mentioned. You can also use a CloudBlobDirectory
object if you prefer. Here's an example showing both.
CloudBlobContainer testContainer = blobClient.GetContainerReference("testcontainer");
//Upload using a CloudBlobDirectory object
var dir = testContainer.GetDirectoryReference("UsingCloudDirectory/foo/bar/baz/");
var blobRef = dir.GetBlockBlobReference("BlobByDir.bin");
using (MemoryStream ms = new MemoryStream(new byte[] { 0x0 }))
{
blobRef.UploadFromStream(ms);
}
//Upload using the filename without a CloudBlobDirectory
var blobRef2 = testContainer.GetBlockBlobReference("UsingBlobName/foo/bar/baz/BlobByName.bin");
using (MemoryStream ms = new MemoryStream(new byte[] { 0x0 }))
{
blobRef2.UploadFromStream(ms);
}