where can i mention my file/filepath to upload to block blog?
-
2012年7月6日 7:40
Hi,
In the following code where can i mention my file/filepath to upload to block blog.
// Retrieve storage account from connection-string CloudStorageAccount storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting("StorageConnectionString")); // 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" CloudBlob blob = container.GetBlobReference("myblob"); // Create or overwrite the "myblob" blob with contents from a local file using (var fileStream = System.IO.File.OpenRead(@"path\myfile")) { blob.UploadFromStream(fileStream); }
すべての返信
-
2012年7月6日 9:03
Hi,
Replace (@"path\myfile") with your file path.
I hope it helps!! If you found this post useful, Please "Mark as answer" or "Vote as Helpful". Thanks! VIJAY.
-
2012年7月8日 16:15モデレータ
Does this thread helps?
It seems the same problem.
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework
- 回答としてマーク Arwind - MSFTModerator 2012年7月18日 3:31
-
2012年7月16日 17:39
One more note is that you may consider using blob.UploadFromFile(string filepath). This allows you to skip the stream call (File.OpenRead(...)), and just place your file path in the method call itself. Ex: blob.UploadFromFile(@"C:\MyFileToUpload.txt");
Hope that helps!
-Jeff
- 回答としてマーク Arwind - MSFTModerator 2012年7月18日 3:31

