Skip to content

Commit

Permalink
Azure-Blob-Storage
Browse files Browse the repository at this point in the history
  • Loading branch information
KonduruKeerthi committed Jul 3, 2024
1 parent 7195861 commit 66b4436
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ public async Task<IActionResult> EditDocument()
MemoryStream outputStream = new MemoryStream();
pptxDocument.Save(outputStream);

//Set the position as '0'
outputStream.Position = 0;

//Download the PowerPoint file in the browser
FileStreamResult fileStreamResult = new FileStreamResult(outputStream, "application/powerpoint");
fileStreamResult.FileDownloadName = "EditPowerPoint.pptx";
Expand All @@ -72,6 +69,12 @@ public async Task<IActionResult> EditDocument()
return Content("Error occurred while processing the file.");
}
}
/// <summary>
/// Download file from Azure Blob cloud storage
/// </summary>
/// <param name="bucketName"></param>
/// <param name="key"></param>
/// <returns></returns>
public async Task<MemoryStream> GetDocumentFromAzure(string connectionString, string containerName, string blobName)
{
try
Expand All @@ -94,7 +97,6 @@ public async Task<MemoryStream> GetDocumentFromAzure(string connectionString, st
throw; // or handle the exception as needed
}
}

public IActionResult Privacy()
{
return View();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public async Task<IActionResult> UploadDocument()
//Saves the PowerPoint document to MemoryStream
MemoryStream stream = new MemoryStream();
pptxDocument.Save(stream);
stream.Position = 0;

//Your Azure Storage Account connection string
string connectionString = "Your_connection_string";
Expand All @@ -90,6 +89,12 @@ public async Task<IActionResult> UploadDocument()

return Ok("PowerPoint document uploaded to Azure Blob Storage.");
}
/// <summary>
/// Upload file to Azure Blob cloud storage
/// </summary>
/// <param name="bucketName"></param>
/// <param name="key"></param>
/// <returns></returns>
public async Task<MemoryStream> UploadDocumentToAzure(string connectionString, string containerName, string blobName, MemoryStream stream)
{
try
Expand All @@ -108,7 +113,6 @@ public async Task<MemoryStream> UploadDocumentToAzure(string connectionString, s
}
return stream;
}

public IActionResult Privacy()
{
return View();
Expand Down

0 comments on commit 66b4436

Please sign in to comment.