0

I am using an ASP.NET Core Web API application. I have an endpoint in which a user can upload a file. The file is uploaded in chunks, once all the chunks are uploaded then the file is merged into the actual file after that I am encrypting the file using symmetric key algorithm.

I want to send the user interactive multiple responses of each stage like below:

File Uploaded
Merging File
File Merged
Encrypting File
File Encrypted
Done

How to send these above steps as responses from one endpoint?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Please read the tag description. You should not tag both asp.net and asp.net core, both are different frameworks. Same for .net and .net core. Choose a version. – JHBonarius May 23 '22 at 05:42
  • Possible dupe https://stackoverflow.com/questions/30119216/uploading-a-large-file-up-to-100gb-through-asp-net-application – JHBonarius May 23 '22 at 05:44
  • Does this answer your question? [Uploading and Downloading large files in ASP.NET Core 3.1?](https://stackoverflow.com/questions/62502286/uploading-and-downloading-large-files-in-asp-net-core-3-1) – JHBonarius May 23 '22 at 05:44
  • @JHBonarius I am not asking for large file upload. I am asking for returning multiple responses from endpoint. – Saghar Francis May 23 '22 at 05:46
  • Maybe you need signalR? https://learn.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-6.0 – yip102011 May 23 '22 at 05:49
  • 1
    Either use something like signalR or maybe add an endpoint to your API that the user can poll every so often to get the current status of the file progress. – lordvlad30 May 23 '22 at 06:07

1 Answers1

0

Your understanding of the upload process is still relatively clear. The uploading process is analyzed in great detail.

Usually we will set a variable Progress when uploading, and use it to record the progress of the upload.

In this requirement, we create at least two methods, one is UploadFile, the other is ShowProcess, so we can get the progress.

If the above requirement of showing upload progress can satisfy you, that's fine. If not, please refer to the code below.

Chunk Upload

The overall idea is the same, set a status value globally, and modify the status code after the process of file merging is executed.

Jason Pan
  • 15,263
  • 1
  • 14
  • 29