首页 > 解决方案 > 如何在不使用ng2-file uploader之类的插件的情况下以角度上传多个文件

问题描述

想要使用除 ng2 文件上传器之外的不同表单控件在同一表单中上传多个文件。

我在单个表单控件中获得多个文件上传器,但我想在同一个表单 component.html 中以不同表单控件上传多个文件

[uploader]="uploader" formControlName="imageUpload" multiple  />
      <td nowrap>
  <button type="button" class="btn btn-success btn-xs
     (click)="item.upload()" [disabled]="item.isReady || item.isUploading || item.isSuccess">
     <span ></span> Upload </button> 
 <button type="button"s"
    (click)="uploader.uploadAll()" [disabled]="!uploader.getNotUploadedItems().length">
     <span></span> Upload all</button>
                            ```
component.ts
```public uploader:FileUploader = new FileUploader({url: URL,authToken:`Bearer ${this.Token}` });
  public hasBaseDropZoneOver:boolean = false;
  public hasAnotherDropZoneOver:boolean = false;

  public fileOverBase(e:any):void {
    this.hasBaseDropZoneOver = e;
  }

  public fileOverAnother(e:any):void {
    this.hasAnotherDropZoneOver = e;
  }```                       

标签: angular7

解决方案


推荐阅读