diff --git a/Read-and-save-PowerPoint-presentation/Open-and-save-PowerPoint/AWS-S3-Bucket/Open-PowerPoint-document/Open-PowerPoint-document/Controllers/HomeController.cs b/Read-and-save-PowerPoint-presentation/Open-and-save-PowerPoint/AWS-S3-Bucket/Open-PowerPoint-document/Open-PowerPoint-document/Controllers/HomeController.cs index 742dafd9..600ce066 100644 --- a/Read-and-save-PowerPoint-presentation/Open-and-save-PowerPoint/AWS-S3-Bucket/Open-PowerPoint-document/Open-PowerPoint-document/Controllers/HomeController.cs +++ b/Read-and-save-PowerPoint-presentation/Open-and-save-PowerPoint/AWS-S3-Bucket/Open-PowerPoint-document/Open-PowerPoint-document/Controllers/HomeController.cs @@ -52,9 +52,6 @@ public async Task 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"; @@ -67,6 +64,12 @@ public async Task EditDocument() return Content("Error occurred while processing the file."); } } + /// + /// Download file from AWS S3 cloud storage + /// + /// + /// + /// public async Task GetDocumentFromS3(string bucketName, string key) { //Configure AWS credentials and region @@ -104,7 +107,6 @@ public async Task GetDocumentFromS3(string bucketName, string key) throw; // or handle the exception as needed } } - public IActionResult Privacy() { return View(); diff --git a/Read-and-save-PowerPoint-presentation/Open-and-save-PowerPoint/AWS-S3-Bucket/Save-PowerPoint-document/Save-PowerPoint-document/Controllers/HomeController.cs b/Read-and-save-PowerPoint-presentation/Open-and-save-PowerPoint/AWS-S3-Bucket/Save-PowerPoint-document/Save-PowerPoint-document/Controllers/HomeController.cs index 8196eeaf..861b7c7b 100644 --- a/Read-and-save-PowerPoint-presentation/Open-and-save-PowerPoint/AWS-S3-Bucket/Save-PowerPoint-document/Save-PowerPoint-document/Controllers/HomeController.cs +++ b/Read-and-save-PowerPoint-presentation/Open-and-save-PowerPoint/AWS-S3-Bucket/Save-PowerPoint-document/Save-PowerPoint-document/Controllers/HomeController.cs @@ -75,7 +75,6 @@ public async Task UploadDocument() //Saves the PowerPoint document to MemoryStream MemoryStream stream = new MemoryStream(); pptxDocument.Save(stream); - stream.Position = 0; //Your AWS Storage Account bucket name string bucketName = "your-bucket-name"; @@ -88,6 +87,13 @@ public async Task UploadDocument() return Ok("PowerPoint document uploaded to AWS S3 Storage."); } + /// + /// Upload file to AWS S3 cloud storage + /// + /// + /// + /// + /// public async Task UploadDocumentToS3(string bucketName, string key, MemoryStream stream) { //Configure AWS credentials and region @@ -119,7 +125,6 @@ public async Task UploadDocumentToS3(string bucketName, string key } return stream; } - public IActionResult Privacy() { return View();