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; }
Source: stackoverflow.com