解决方法
W3.org:
‘File对象是一个带有name属性的Blob对象,它是一个字符串;’
如果是文件:
var d = new Date(2013,12,5,16,23,45,600); var generatedFile = new File(["Rough Draft ...."],"Draft1.txt",{type: 'text/plain',lastModified: d}); console.log(typeof generatedFile.name == 'string'); // true
如果是Blob:
var blob = new Blob(); console.log(typeof blob.name); // undefined
条件:
var isFile = typeof FileOrBlob.name == 'string';