<分区>
我正在尝试从 FileList 对象中过滤或删除一些文件。我得到了一个 FileList 对象形式的目录选择器。
<input type="file" accept="image/*" webkitdirectory directory multiple>
在我的 .ts 文件中:
public fileChangeListener($event: any) {
let selectedFiles=$event.target.files; //Object of Filelist
}
selectedFileList 包含不同类型的文件,如 image/jpg、image/png、application/javascript、application/pdf 等。我想获得一个只有图像类型文件的 FileList 对象。我怎样才能得到它?
注意:HTML 输入元素中的 accept="image/*"在这里不起作用。
{
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",
}
在我的代码中error: files.slice is not a function