SalesBuy
1-855-856-7678
Technical SupportSupport
'Deklaracja Public Overridable Sub UploadFile ( _ fileName As String, _ options As BlobRequestOptions _ )
public void UploadFile ( String fileName, BlobRequestOptions options )
public function UploadFile ( fileName : String, options : BlobRequestOptions )
Type: System.String
The path and file name of the file to upload.
Type: Microsoft.WindowsAzure.StorageClient.BlobRequestOptions
An object that specifies any additional options for the request.
The following code example uploads a file from the local computer to a blob, using the specified blob request options.
static void UploadBlobFromFile(Uri blobEndpoint, string accountName, string accountKey) { // Create a service client for credentialed-access to the blob. CloudBlobClient blobClient = new CloudBlobClient(blobEndpoint, new StorageCredentialsAccountAndKey(accountName, accountKey)); // Get a reference to a container, which may or may not already exist in the cloud. CloudBlobContainer container = blobClient.GetContainerReference("mycontainer"); // Create a new container in the cloud if one with this container address does not already exist. container.CreateIfNotExist(); // Get a reference to a blob, which may or may not exist. CloudBlob blob = container.GetBlobReference("myfile.txt"); // Create a BlobRequestOptions object. BlobRequestOptions options = new BlobRequestOptions(); // Use the BlobRequestOptions object to set options for the request. // E.g., Specify a retry policy of 10 retries. options.RetryPolicy = RetryPolicies.RetryExponential(10, RetryPolicies.DefaultClientBackoff); // Upload content to the blob, which will create the blob if it does not already exist. // If the operation fails, try it again - up to ten retries before giving up. blob.UploadFile("c:\\myfile.txt", options); }
The maximum size for a block blob is 200 GB, and a block blob can include no more than 50,000 blocks.