Ich benutze die ng2-file-upload
-Paket schlägt eine ASP.NET Core
Backend.ng2-Datei-Upload ASP.NET Core MVC - Chunk Upload Fortschritt
https://github.com/valor-software/ng2-file-upload
das Basis Beispiel verwenden, um eine große Datei-Upload ~ 50MB zu testen versuchen.
Die Datei wird schließlich hochgeladen, aber es findet keine Fortschritts-/Chunk-Aktion statt. Es lädt im Grunde alle auf einmal nach einer Weile.
Was muss ich ändern, um den Fortschritt/Chunk-Upload zu erhalten?
NG2 Komponente:
import { Component, OnInit } from '@angular/core';
import { FileUploader } from 'ng2-file-upload';
@Component({
selector: 'fileupload',
templateUrl: './fileupload.component.html'
})
export class FileUploadComponent implements OnInit {
public uploader: FileUploader = new FileUploader({ url: '/api/purchaseorder/upload' });
ngOnInit() {
this.uploader.onCompleteItem = (item: any, response: any, status: any, headers: any) => {
console.log("ImageUpload:uploaded:", item, status);
};
}
public hasBaseDropZoneOver: boolean = false;
public hasAnotherDropZoneOver: boolean = false;
public fileOverBase(e: any): void {
this.hasBaseDropZoneOver = e;
}
public fileOverAnother(e: any): void {
this.hasAnotherDropZoneOver = e;
}
}
asp.net mvc controller/action:
public ActionResult Upload(IFormFile file)
{
if (file == null || file.Length == 0)
{
return NoContent();
}
// handle file here
return Ok();
}