Browse Source

Pull request #263265: BI-143459 fix: 修复请求头与data中boundary不一致问题

Merge in DEC/fineui from ~AUSTIN.DUAN/decision-fineui:release/11.0 to release/11.0

* commit '86d33217d74998010f088ee058c5e0cb49518cbf':
  BI-143459 fix: 修复请求头boundary与formData中WebKitFormBoundary不一致问题
  BI-143459 fix: 修复请求头boundary与formData中WebKitFormBoundary不一致问题
research/test
Austin.Duan-段嗣跃 9 months ago
parent
commit
bc3e5e9ee9
  1. 7
      packages/fineui/src/base/single/input/file.js

7
packages/fineui/src/base/single/input/file.js

@ -242,14 +242,11 @@ const sendFile = (toString => {
upload.onloadstart(); upload.onloadstart();
} }
} }
const boundary = `AjaxUploadBoundary${new Date().getTime()}`;
xhr.setRequestHeader("Content-Type", `multipart/form-data; boundary=${boundary}`);
if (handler.file.getAsBinary) { if (handler.file.getAsBinary) {
const boundary = `AjaxUploadBoundary${new Date().getTime()}`;
xhr.setRequestHeader("Content-Type", `multipart/form-data; boundary=${boundary}`);
xhr[xhr.sendAsBinary ? "sendAsBinary" : "send"](multipart(boundary, handler.name, handler.file)); xhr[xhr.sendAsBinary ? "sendAsBinary" : "send"](multipart(boundary, handler.name, handler.file));
} else { } else {
xhr.setRequestHeader("Content-Type", "multipart/form-data");
// xhr.setRequestHeader("X-Name", handler.name);
// xhr.setRequestHeader("X-File-Name", handler.file.fileName);
const form = new FormData(); const form = new FormData();
form.append("FileData", handler.file); form.append("FileData", handler.file);
xhr.send(form); xhr.send(form);

Loading…
Cancel
Save