app.component.html
<label for="file">Choose File</label>
<input type="file" id="file"(change)="Fileupload($event.target.files)">
app.component.ts
import { Component, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
import { Input } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements AfterViewInit {
UploadFile: File = null;
constructor()
{
}
Fileupload(files: FileList) {
this.UploadFile = files.item(0);
}
}
output:
hire dedicated angular developers from Infomaze to build robust, secure, and reliable web applications and portals.
ReplyDelete