1
我正在使用ng2-file-upload
包打到ASP.NET Core
後端。ng2-file-upload ASP.NET Core MVC - 大塊上傳進度
https://github.com/valor-software/ng2-file-upload
使用基本例如,嘗試測試大文件的上傳〜50MB。
該文件最終上傳,但沒有進展/塊動作正在發生。它基本上在坐了一會之後立即上傳。
我需要更改以獲取進度/塊上載?
NG2組件:
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的控制器/動作:
public ActionResult Upload(IFormFile file)
{
if (file == null || file.Length == 0)
{
return NoContent();
}
// handle file here
return Ok();
}