ASP.NET Core 2.0 and Angular 4.3 File Upload with progress

Viewed 6174

Using the new Angular 4.3 HttpClient, how can I upload and access files in an ASP.NET Core 2.0 Controller while reporting upload progress to the client?

2 Answers

You could use the interface Microsoft.AspNetCore.Http.IFormFile that represents a file sent with the HttpRequest to simplify the access to file.

[HttpPost, DisableRequestSizeLimit, Route("api/files")]
public async Task UploadFiles(IFormFile file){
    //your file stream
    var stream = file.OpenReadStream();
}
Related