我有一个正在上传的文件表单。
samplemenuupload(event){
let submittedpdfs = event.target.files;
for(let pdf in submittedpdfs){
console.log(submittedpdfs[+pdf]);
if(submittedpdfs[+pdf].type !== acceptedpdf){
submittedpdfs.splice(+pdf,1);
}
}
文件对象如下所示。正如你所看到的,它有一个
type
所有物
File(127001) {name: "2017-02-23-statements-1469.pdf", lastModified: 1492974543668, lastModifiedDate: Sun Apr 23 2017 14:09:03 GMT-0500 (CDT), webkitRelativePath: "", size: 127001, â¦}
lastModified:1492974543668
lastModifiedDate:Sun Apr 23 2017 14:09:03 GMT-0500 (CDT) {}
name:"2017-02-23-statements-1469.pdf"
size:127001
type:"application/pdf"
webkitRelativePath:""
当我检查if语句中的类型时,会出现以下错误:
ERROR TypeError: Cannot read property 'type' of undefined
怎么了?我做错什么了?