How to send multipart/form-data with antd upload react

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to send multipart/form-data with antd upload react



I am using react and antd.

The component I am using from antd is Drag and Drop.

I am trying to send multipart/form-data using FormData object.

It sends the file (.zip file that should be sent as blob) but it does not send it as blob nor anything related to the other keys and values.

Here's a Sandbox.



Expected Request Payload:


------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



Actual Request Paylod:


------WebKitFormBoundaryysdTGvf0cRZVGpQ4
Content-Disposition: form-data; name="file"; filename="aFileName.zip"
Content-Type: application/zip


------WebKitFormBoundaryysdTGvf0cRZVGpQ4




1 Answer
1



I have used customRequest to solve this problem.

You can find an example here: Send multipart/form-data with antd upload #11616






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard