非常简单和最快的方法是使用NG2-文件上传.安装NG2-文件-通过NPM上传。npm i ng2-file-upload --save首先,在您的模块中导入模块。import { FileUploadModule } from 'ng2-file-upload';Add it to [imports] under @NgModule:imports: [ ... FileUploadModule, ... ]标记:<input ng2FileSelect type="file" accept=".xml" [uploader]="uploader"/>在你们的评语中:import { FileUploader } from 'ng2-file-upload';...uploader: FileUploader = new FileUploader({ url: "api/your_upload", removeAfterUpload: false, autoUpload: true });这是最简单的用法。知道这一切的力量演示