0

I have an API application (server side: C# ASP.NET Core 7, client side: React).

I need to allow downloading files and uploading files, up to 5 GB. How would you recommend I do this?

I understand that recommended to do this asynchronously and with streaming. (and uploaded with chunk).

I tried some sample code snippets from the internet and it didn't work properly.

I would be happy to help both how it should be and if you can give me an example that works.

Thank you!

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
prog_prog
  • 371
  • 2
  • 5
  • 15
  • Have a look at [this](https://stackoverflow.com/questions/62502286/uploading-and-downloading-large-files-in-asp-net-core-3-1) – Qing Guo Jul 24 '23 at 06:24

1 Answers1

0

File Upload

In ASP.NET Core MVC, the maximum upload result for file upload is 20MB by default. If we want to upload some relatively large files, let's see how to install it.

Step 1 Without WebConfig:

To set the file upload size limit to 40 MB, we need to add the following code to the ConfigureServices method.

public void ConfigureServices(IServiceCollection services)
{
    services.Configure<FormOptions>(options =>
    {
        options.MultipartBodyLengthLimit = 40000000;//40MB
    });
}
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 26 '23 at 16:22