ソースを参照

xhr-upload: add filename to FormData with `bundle: true` (#1487)

Fixes #1486
Renée Kooi 6 年 前
コミット
46c6b0eb82
1 ファイル変更6 行追加1 行削除
  1. 6 1
      packages/@uppy/xhr-upload/src/index.js

+ 6 - 1
packages/@uppy/xhr-upload/src/index.js

@@ -372,7 +372,12 @@ module.exports = class XHRUpload extends Plugin {
       const formData = new FormData()
       const formData = new FormData()
       files.forEach((file, i) => {
       files.forEach((file, i) => {
         const opts = this.getOptions(file)
         const opts = this.getOptions(file)
-        formData.append(opts.fieldName, file.data)
+
+        if (file.name) {
+          formData.append(opts.fieldName, file.data, file.name)
+        } else {
+          formData.append(opts.fieldName, file.data)
+        }
       })
       })
 
 
       const xhr = new XMLHttpRequest()
       const xhr = new XMLHttpRequest()