Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9137875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:11:01+00:00 2026-06-17T09:11:01+00:00

I am trying to upload a file to Windows Azure blob storage. From my

  • 0

I am trying to upload a file to Windows Azure blob storage. From my understanding, you can upload files into something similar to a subdirectory. I want to upload a file to a blob such that the file essentially resides in /TestContainer/subDirectory1/subDirectory2/file.png

// Setup the Windows Aure blob client
CloudStorageAccount storageAccount = CloudStorageAccount.FromConfigurationSetting("BlobStorage");
CloudBlobClient client = storageAccount.CreateCloudBlobClient();

// Retrieve the TestContainer container from blob storage
CloudBlobContainer container = client.GetContainerReference("TestContainer");
if (container.CreateIfNotExist())
  container.SetPermissions(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob });

// Setup the blob
CloudBlob blob = container.GetBlobReference("");

// Create the meta data for the blob
NameValueCollection metadata = new NameValueCollection();
metadata["id"] = fileID.ToString();
blob.Metadata.Add(metadata);

// Store the blob 
byte[] bytes = GetFileBytes();
blob.UploadByteArray(bytes);

How do I upload a file with a directory structure? The link here mentions there’s a way to do it. However, it doesn’t show you how to do it.

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:11:02+00:00Added an answer on June 17, 2026 at 9:11 am

    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);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to upload a file to a Windows Azure storage blob. I feel
I'm having an issue trying to directly upload a file to azure blob storage.
I'm trying to setup a video file upload using UDP protocol onto Windows Azure
I'm trying to upload a file using Watin and C#. Under Windows XP, Watin
I am trying to upload a file from a flash widget to my rails
I'm trying to upload a file via FTP from my local computer to an
I'm using Windows Azure Mobile services to upload pictures from a mobile app. The
I am trying to drop a file from windows explorer to my form and
I'm trying to do a simple file upload page but keep getting can't convert
I'm trying to upload a zip file and a csv file from HTML form.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.