At the moment my script can only handle one file being added:
fileEvent(fileInput: Event){
this.fileName = (<HTMLInputElement>fileInput.target).files[0].name;
this.fileSize = Math.round(((<HTMLInputElement>fileInput.target).files[0].size) / 1000);
this.fileAdded = true;
}
This is the HTML:
<input (change)="fileEvent($event)" type="file" name="files" accept=".pcap" style='display: none;' #file>
<div id="filelist" *ngIf="fileAdded">
<p id="file">{{ fileName }}</p>
<p id="filesize">{{ fileSize }} KB</p>
</div>
I'm wondering how I can get the number of files inside the Input Element. I'm trying to loop through the elements to get their names and sizes so I can display them on my website.
EDIT: Apparently I haven't tried the most obvious thing, which is adding .length at the end. That solves it.
this.numOfFiles = (<HTMLInputElement>fileInput.target).files.length;