如何在不使用ng2-file uploader之类的插件的情况下以角度上传多个文件

时间:2019-06-03 13:29:12

标签: angular7

想使用不同的Form控件以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;
  }```                       

0 个答案:

没有答案