【发布时间】:2018-01-22 13:39:12
【问题描述】:
我已使用文件读取器对象将文件转换为数组缓冲区。在 IE11 中,它适用于最大 20mb 的文件。但不适用于 200mb 文件,它会导致 null 而不是数组缓冲区值。下面提到了我的代码
var fr = new FileReader();
//reads in the file using the fileReader HTML5 API (as an ArrayBuffer) - readAsBinaryString is not available in IE!
fr.readAsArrayBuffer(file);
fr.onload = (evt:any) => {
console.log(evt.target.result);// it returns only null for 200mb file
}
值得赞赏的宝贵回应。
【问题讨论】:
-
readAsArrayBuffer会将整个文件读入内存,所以 IE 可能对此有一些限制。您可能面临的另一个问题是服务器端,可能在发送整个文件之前超时等。您到底在做什么? -
我认为这可能是 IE 限制问题,在将缓冲区发布到服务器之前它在转换为缓冲区时变为空值