작은 파일은 동시에 5 개의 메가 바이트 파일을 업로드하더라도 원활하게 진행되지만 (한 번에 5 개만 처리하고 나머지는 대기시킵니다) 150MB 파일로 인해 브라우저가 중지됩니다 시작하는 동안 몇 초.큰 파일 업로드로 인해 브라우저가 중단됩니다.
function start(file) {
var xhr = new XMLHttpRequest();
++count;
var container = document.createElement("tr");
var line = document.createElement("td");
container.appendChild(line);
line.textContent = count + ".";
var filename = document.createElement("td");
container.appendChild(filename);
filename.textContent = file.fileName;
filename.className = "filename";
initXHREventTarget(xhr.upload, container);
var tbody = document.getElementById('tbody');
tbody.appendChild(container);
tbody.style.display = "";
var boundary = "xxxxxxxxx";
xhr.open("POST", "uploader.php");
xhr.setRequestHeader("Content-Type", "multipart/form-data, boundary="+boundary); // simulate a file MIME POST request.
xhr.setRequestHeader("Content-Length", file.size);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if ((xhr.status >= 200 && xhr.status <= 200) || xhr.status == 304) {
if (xhr.responseText != "") {
alert(xhr.responseText); // display response.
}
}
}
}
var body = "--" + boundary + "\r\n";
body += "Content-Disposition: form-data; name='upload'; filename='" + file.fileName + "'\r\n";
body += "Content-Type: application/octet-stream\r\n\r\n";
body += $.base64Encode(file.getAsBinary()) + "\r\n";
body += "--" + boundary + "--";
xhr.sendAsBinary(body);
}
엄청난 양의 데이터에 비추어 예상되는 동작과 비슷하게 들리지만 그렇지 않습니까? 이게 정말 문제 야? –
큰 파일을 검색하고 게시하는 동안 브라우저가 멈추는 유일한 불만 사항이 있습니까? –