CloudBlockBlob.UploadFromFile(String, AccessCondition, BlobRequestOptions, OperationContext) CloudBlockBlob.UploadFromFile(String, AccessCondition, BlobRequestOptions, OperationContext) Method


Uploads a file to the Blob service. If the blob already exists, it will be overwritten.

public virtual void UploadFromFile (string path, Microsoft.WindowsAzure.Storage.AccessCondition accessCondition = null, Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions options = null, Microsoft.WindowsAzure.Storage.OperationContext operationContext = null);
abstract member UploadFromFile : string * Microsoft.WindowsAzure.Storage.AccessCondition * Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions * Microsoft.WindowsAzure.Storage.OperationContext -> unit
override this.UploadFromFile : string * Microsoft.WindowsAzure.Storage.AccessCondition * Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions * Microsoft.WindowsAzure.Storage.OperationContext -> unit


String String

A string containing the file path providing the blob content.

AccessCondition AccessCondition

An AccessCondition object that represents the condition that must be met in order for the request to proceed.

BlobRequestOptions BlobRequestOptions

A BlobRequestOptions object that specifies additional options for the request. If null, default options are applied to the request.

OperationContext OperationContext

An OperationContext object that represents the context for the current operation.



// This is one common way of creating a CloudStorageAccount object. You can get 
// your Storage Account Name and Key from the Azure Portal.
StorageCredentials credentials = new StorageCredentials(accountName, accountKey);
CloudStorageAccount storageAccount = new CloudStorageAccount(credentials, useHttps: true);

// Another common way to create a CloudStorageAccount object is to use a connection string:
// CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);

CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

// This call creates a local CloudBlobContainer object, but does not make a network call
// to the Azure Storage Service. The container on the service that this object represents may
// or may not exist at this point. If it does exist, the properties will not yet have been
// popluated on this object.
CloudBlobContainer blobContainer = blobClient.GetContainerReference(containerName);

// This makes an actual service call to the Azure Storage service. Unless this call fails,
// the container will have been created.

// This also does not make a service call, it only creates a local object.
CloudBlockBlob blob = blobContainer.GetBlockBlobReference(blobName);

// This transfers data in the file to the blob on the service.

Applies to