Answers for "file upload in material ui angular"

0

File Upload with Angular Material

<mat-form-field class="columns">
    <mat-label *ngIf="selectedFiles; else newFile">{{selectedFiles.item(0).name}}</mat-label>
    <ng-template #newFile>
        <mat-label>Choose file</mat-label>
    </ng-template>
    <input matInput disabled>
    <button mat-icon-button matSuffix (click)="fileInput.click()">
        <mat-icon>attach_file</mat-icon>
    </button>
    <input hidden (change)="selectFile($event)" #fileInput type="file" id="file">
</mat-form-field>


::::::::: AND TS ::::::
selectFile(event) {
    this.selectedFiles = event.target.files;
}
Posted by: Guest on August-21-2021
0

how to upload file in material ui

<Button
  variant="contained"
  component="label"
>
  Upload File
  <input
    type="file"
    hidden
  />
</Button>
Posted by: Guest on September-01-2021

Browse Popular Code Answers by Language