where can i mention my file/filepath to upload to block blog?
-
2012年7月6日 上午 07: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日 上午 09: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日 下午 04: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日 上午 03:31
-
2012年7月16日 下午 05: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日 上午 03:31

