var file = new File(["foo"], "foo.txt", {
type: "text/plain",
});
使用上面的代码创建file对象,在ie11里面报Function expected,chrome里面是没问题的
var file = new File(["foo"], "foo.txt", {
type: "text/plain",
});
使用上面的代码创建file对象,在ie11里面报Function expected,chrome里面是没问题的
IE11 does not support the File constructor.
https://caniuse.com/#feat=fil...
https://developer.mozilla.org...
也许你看到了中文的mdn上兼容性的表述
觉得ie的basic support是到ie10的
那么不妨看看同样是mdn上同一页面的英文版
你会发现ie其实是nosupport的
然后我们自己看下ie和chrome里的表现。。
// let file = new File([dataFile], that.curFilename, {type: dataFile.type, lastModified: Date.now()})
/* const isLt5M = file.size / 1024 / 1024 < 5
if (!isLt5M) {
that.$message.error('剪切后的图片大于5M')
return
} */
let data = new FormData() // operatorId
// data.append('file', dataFile) 把这行
data.append('file', dataFile, that.curFilename) 改成这行
13 回答12.7k 阅读
7 回答1.9k 阅读
3 回答1.1k 阅读✓ 已解决
2 回答1.1k 阅读✓ 已解决
6 回答812 阅读✓ 已解决
6 回答1k 阅读
2 回答1.3k 阅读✓ 已解决
可以修改filename,formData.append第三个参数就是,例子:
另外IE中不支持new File的写法,详见https://caniuse.com/#search=file