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

  • SEARCH
  • Home
  • 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 9310095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:01:39+00:00 2026-06-19T01:01:39+00:00

Calling UploadFromStream overwrites files by default – how can I make sure I only

  • 0

Calling UploadFromStream overwrites files by default – how can I make sure I only upload a blob if it isn’t already in the container?

CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobName);
blockBlob.UploadFromStream(stream)
  • 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-19T01:01:40+00:00Added an answer on June 19, 2026 at 1:01 am

    Add an access condition to the code so that it checks against the ETag property of the blob – wildcards are allowed, so we want to only allow the upload if no blobs with this name have any etag (which is a roundabout way of saying, does this blob name exist).

    You get a StorageException as detailed below.

        CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobName);
        try {
            blockBlob.UploadFromStream(stream, accessCondition: AccessCondition.GenerateIfNoneMatchCondition("*"));
        } catch (StorageException ex) {
            if (ex.RequestInformation.HttpStatusCode == (int)System.Net.HttpStatusCode.Conflict) {
                // Handle duplicate blob condition
            }
            throw;
        }     
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Calling Index view is giving me this very very annoying error . Can anybody
Calling OnPropertyChanged for an ObservableCollection only works when there has been some change to
Calling System.gc() requests that garbage collection takes place, and isn't guaranteed. The part about
Calling the setTimeout function will return an integer ID so that clearTimeout can be
Calling std::count_if(vec.begin(), vec.end(), std::bind2nd(std::ptr_fun(foo), 17)) works fine with bool foo(int, int), but I can't
Calling the function MakeTree(4, gameboard) does not work properly, it only prints out the
Calling org.apache.zookeeper.server.quorum.QuorumPeerMain.main() isn't working.
Calling uploader.start() before any files are selected results in error in plupload. For example,
Calling a Lua function from C is fairly straight forward but is there a
Calling MyPanel.Panel1.Hide(); or MyPanel.Panel2.Hide(); simply hides the controls inside the panel... but I want

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.