Advertisement
Kulasangar

Upload a file to Blob

Feb 21st, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. var credentials = new StorageCredentials("deldysoft",
  2.                                         "YOUR PRIMARY KEY FROM. GET IT FROM THE MANGEMENT PORTAL");
  3. var client = new CloudBlobClient(new Uri("http://deldysoft.blob.core.windows.net/"), credentials);
  4.  
  5. // Retrieve a reference to a container. (You need to create one using the mangement portal, or call container.CreateIfNotExists())
  6. var container = client.GetContainerReference("deldydk");
  7.  
  8. // Retrieve reference to a blob named "myfile.gif".
  9. var blockBlob = container.GetBlockBlobReference("myfile.gif");
  10.  
  11. // Create or overwrite the "myblob" blob with contents from a local file.
  12. using (var fileStream = System.IO.File.OpenRead(@"C:\\myfile.gif"))
  13. {
  14.   blockBlob.UploadFromStream(fileStream);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement