File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
WebApp-Storage-DotNet/Controllers Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ namespace WebApp_Storage_DotNet.Controllers
2323 using Microsoft . WindowsAzure . Storage ;
2424 using Microsoft . WindowsAzure . Storage . Blob ;
2525 using Microsoft . Azure ;
26+ using System . Configuration ;
2627
2728 /// <summary>
2829 /// Azure Blob Storage Photo Gallery - Demonstrates how to use the Blob Storage service.
@@ -62,7 +63,7 @@ public async Task<ActionResult> Index()
6263 {
6364 // Retrieve storage account information from connection string
6465 // How to create a storage connection string - http://msdn.microsoft.com/en-us/library/azure/ee758697.aspx
65- CloudStorageAccount storageAccount = CloudStorageAccount . Parse ( CloudConfigurationManager . GetSetting ( "StorageConnectionString" ) ) ;
66+ CloudStorageAccount storageAccount = CloudStorageAccount . Parse ( ConfigurationManager . AppSettings [ "StorageConnectionString" ] . ToString ( ) ) ;
6667
6768 // Create a blob client for interacting with the blob service.
6869 blobClient = storageAccount . CreateCloudBlobClient ( ) ;
@@ -111,7 +112,7 @@ public async Task<ActionResult> UploadAsync()
111112 for ( int i = 0 ; i < fileCount ; i ++ )
112113 {
113114 CloudBlockBlob blob = blobContainer . GetBlockBlobReference ( GetRandomBlobName ( files [ i ] . FileName ) ) ;
114- await blob . UploadFromFileAsync ( files [ i ] . FileName ) ;
115+ await blob . UploadFromFileAsync ( files [ i ] . FileName , FileMode . Open ) ;
115116 }
116117 }
117118 return RedirectToAction ( "Index" ) ;
You can’t perform that action at this time.
0 commit comments