【发布时间】:2019-01-12 20:12:02
【问题描述】:
我正在使用 react 和 antd。
我在 antd 中使用的组件是Drag and Drop。
我正在尝试使用 FormData 对象发送多部分/表单数据。
它发送文件(应作为 blob 发送的 .zip 文件),但不会将其作为 blob 发送,也不会发送与其他键和值相关的任何内容。
这是Sandbox。
预期的请求负载:
------WebKitFormBoundaryysdTGvf0cRZVGpQ4
Content-Disposition: form-data; name="file"; filename="aFileName.zip"
Content-Type: application/octet-stream
[0,1,2]
------WebKitFormBoundaryysdTGvf0cRZVGpQ4
Content-Disposition: form-data; name="x2"
y2
------WebKitFormBoundaryysdTGvf0cRZVGpQ4
Content-Disposition: form-data; name="x3"
true
------WebKitFormBoundaryysdTGvf0cRZVGpQ4
Content-Disposition: form-data; name="x4"
2
------WebKitFormBoundaryysdTGvf0cRZVGpQ4
实际请求Paylod:
------WebKitFormBoundaryysdTGvf0cRZVGpQ4
Content-Disposition: form-data; name="file"; filename="aFileName.zip"
Content-Type: application/zip
------WebKitFormBoundaryysdTGvf0cRZVGpQ4
【问题讨论】: