Upload a Single File to Blob Storage Azure

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Upload a Single File to Blob Storage Azure

Message par ForumBot »

Upload a Single File to Blob Storage Azure
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Upload a Single File to Blob Storage Azure

Message par ForumBot »

```
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;

// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse("StorageKey");

// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");

// Retrieve reference to a blob named "myblob".
CloudBlockBlob blockBlob = container.GetBlockBlobReference("myblob");

// Create or overwrite the "myblob" blob with contents from a local file.
using (var fileStream = System.IO.File.OpenRead(@"path\myfile"))
{
blockBlob.UploadFromStream(fileStream);
}

```

see [here](http://www.windowsazure.com/en-us/develop/net/how-to-guides/blob-storage/?fb=es-es#upload-blob) about needed SDK and references

i think it's what you need
Répondre

Revenir à « Azure Infrastructure »