From 313a6efcf3fd41c31b5ec178057b7e1f7b048bc0 Mon Sep 17 00:00:00 2001 From: Michael Miklis Date: Tue, 25 Aug 2020 11:02:20 +0200 Subject: [PATCH] Fixed ContentType for blob files added content type support for uploaded files and use InputStream for Azure Blob Stream --- WebApp-Storage-DotNet/Controllers/HomeController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WebApp-Storage-DotNet/Controllers/HomeController.cs b/WebApp-Storage-DotNet/Controllers/HomeController.cs index 9dd9ec5..586cc57 100644 --- a/WebApp-Storage-DotNet/Controllers/HomeController.cs +++ b/WebApp-Storage-DotNet/Controllers/HomeController.cs @@ -112,7 +112,8 @@ public async Task UploadAsync() for (int i = 0; i < fileCount; i++) { CloudBlockBlob blob = blobContainer.GetBlockBlobReference(GetRandomBlobName(files[i].FileName)); - await blob.UploadFromFileAsync(files[i].FileName, FileMode.Open); + blob.Properties.ContentType = files[i].ContentType; + await blob.UploadFromStreamAsync(files[i].InputStream); } } return RedirectToAction("Index");