Browse Source

保证文件返回的顺序

es6
guy 4 years ago
parent
commit
6c52318f29
  1. 8
      src/base/single/input/file.js

8
src/base/single/input/file.js

@ -103,6 +103,7 @@
// FireFox 3+, Safari 4 beta (Chrome 2 beta file is buggy and will not work) // FireFox 3+, Safari 4 beta (Chrome 2 beta file is buggy and will not work)
if (xhr.upload || xhr.sendAsBinary) { if (xhr.upload || xhr.sendAsBinary) {
sendFile = function (handler, maxSize, width, height) { sendFile = function (handler, maxSize, width, height) {
var current = handler.current;
if (-1 < maxSize && maxSize < handler.file.fileSize) { if (-1 < maxSize && maxSize < handler.file.fileSize) {
if (isFunction(handler.onerror)) { if (isFunction(handler.onerror)) {
handler.onerror(); handler.onerror();
@ -190,7 +191,7 @@
if (handler.file.type.indexOf("image") != -1) { if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image"; attachO.attach_type = "image";
} }
handler.attach_array.push(attachO); handler.attach_array[current] = attachO;
} else { } else {
upload["onerror"]({}); upload["onerror"]({});
} }
@ -211,7 +212,7 @@
handler.attach_array[0] = attachO; handler.attach_array[0] = attachO;
// handler.attach_array.push(attachO); // handler.attach_array.push(attachO);
} else { } else {
handler.attach_array.push(attachO); handler.attach_array[current] = attachO;
} }
break; break;
} }
@ -238,6 +239,7 @@
// Internet Explorer, Opera, others // Internet Explorer, Opera, others
else { else {
sendFile = function (handler, maxSize, width, height) { sendFile = function (handler, maxSize, width, height) {
var current = handler.current;
var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"), var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"),
rpe = { rpe = {
loaded: 1, total: 100, simulation: true, interval: setInterval(function () { loaded: 1, total: 100, simulation: true, interval: setInterval(function () {
@ -272,7 +274,7 @@
if (handler.maxlength == 1) { if (handler.maxlength == 1) {
handler.attach_array[0] = attachO; handler.attach_array[0] = attachO;
} else { } else {
handler.attach_array.push(attachO); handler.attach_array[current] = attachO;
} }
} catch (e) { } catch (e) {
if (isFunction(handler.onerror)) { if (isFunction(handler.onerror)) {

Loading…
Cancel
Save