예제 #1
0
 public ActionResult UploadFile()
 {
     ViewBag.Title = "Upload File to Azure Storage";
     //string containerName = "babyimages".ToLower(); //All letters in a container name must be lowercase.
     var blobService = new BlobService(ConfigurationManager.AppSettings["AzureStorageConnection"]); //AzureStorageBLL.CreateBlobServiceClient();
     //blobService.CreatePublicContainer(containerName);
     blobService.UploadFileToBlob(BabybookConfig.ContainerName,  HostingEnvironment.MapPath("~/Images/ps1.jpg"), "2014/");
     var result = blobService.ListBlobs(BabybookConfig.ContainerName, false).Split(new[] { '\r', '\n' },StringSplitOptions.RemoveEmptyEntries);
     ViewBag.BlobList = result;
     return View();
 }