Based on this question and answer ASP.NET Core 2.0 and Angular 4.3 File Upload with progress
ASP.NET returns HTTP events - upload progress and final response:
[HttpPost, DisableRequestSizeLimit, Route("api/files")]
public async Task UploadFiles()
{
var files = Request.Form.Files; // now you have them
}
And Angular accepts the response(s) and handles that:
this.http.request(req).subscribe(event => {
if (event.type === HttpEventType.UploadProgress)
this.uploadProgress = Math.round(100 * event.loaded / event.total);
else if (event instanceof HttpResponse)
console.log('Files uploaded!');
});
My questions:
1) What part of the above ASP.NET code tells that it has to respond UploadProgress until the upload process is done? How does it know that it is a request that needs to respond the UploadProgress? Where is the code in the ASP.NET source code, that return UploadProgress? (https://github.com/aspnet/AspNetCore)
2) Overall flow, is this an HTTP specification? Clearly, there is a rule and I can't find any documentation about it so far.