ASP.NET Core Web API upload and download file

試著忘記壹切 提交于 2019-12-23 12:19:17

问题


My scenario:

  • ASP.NET Core 2.1
  • Web API Controller
  • Azure Blob Storage as storage

I read some docs on internet (and on Stack Overflow in particular), but I didn't find a real complete answer to my question.

Question

Which is the best practice to upload and download BIG files using a ASP.NET Core 2.1 Web Api Controller and Azure Blob Storage as back-end for saving data?

Please, suppose the controller is:

[Route("api/[controller]")]
[ApiController]
public class UploadDownloadController : Controller
{
    [HttpGet("upload")]
    public void Download()
    {
        ...
    }

    [HttpPost]
    public Result Upload([FromBody] string someData)
    {
        ...
    }
}

Where Result is a class to return some data on the operation.

Please note that:

  • For BIG files, it's better not to use IFormFile interface
  • Files can be very big: tens or hundreds giga

Thank you,

Attilio

来源:https://stackoverflow.com/questions/51426999/asp-net-core-web-api-upload-and-download-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!