I need to filter or eliminate certain files from a FileList object that I obtained from a directory chooser.
<input type="file" accept="image/*" webkitdirectory directory multiple>
Within my .ts file:
public fileChangeListener($event: any) {
let selectedFiles=$event.target.files; //Object of Filelist
}
The selectedFileList contains different types of files such as image/jpg, image/png, application/javascript, application/pdf, etc. I specifically want to retrieve a FileList Object with only image type files. How can this be achieved?
Note: The use of `accept="image/*"` in the HTML input element does not have the intended effect here.
{
lastModified:1521624250148,
lastModifiedDate:Wed Mar 21 2018 15:24:10 GMT+0600 (+06) {},
name:"rxlnn70l.bmp",
size:814138,
type:"image/bmp",
webkitRelativePath:"second/rxlnn70l.bmp",
}
In my code I encounter the issue
error: files.slice is not a function
.