Browse Source

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

Fixes #1486
Renée Kooi 6 years ago
parent
commit
46c6b0eb82
1 changed files with 6 additions and 1 deletions
  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()
       files.forEach((file, i) => {
         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()