0

我有几个文件(每个约 30Mb)需要转换为 base64 并上传到服务器。上传部分文件后,IE11 会抛出 TypeMismatchError。文件内容是一个base64字符串,它不是编码问题。网络请求面板不满足它,请求在发送前失败。其他浏览器正常工作。如何解决?

function post(url, data, timeout) {
    return new Promise((resolve, reject) => {
        const xhr = new XMLHttpRequest();
        xhr.open("POST", url, true);
        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

        xhr.onreadystatechange = (result) => {
            if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
                resolve(xhr.responseText);
            }
        };

        xhr.onerror = function (event) {
            reject(event);
        };

        xhr.timeout = timeout;

        xhr.send(data);
    });
}
function handleFileSelect() {
    post('/upload', LARGE_FILE_DATA_BASE64).catch(error => {
        // Throws TypeMismatchError error after few uploads.
    });
}

谷歌只在这里说这个类似的问题:https ://helperbyte.com/questions/276626/jquery-deferrer-typemismatcherror-when-you-bulk-load-data-cant-find-what-this-might-mean

4

0 回答 0