DEV Community

Chidiebere Chukwudi
Chidiebere Chukwudi

Posted on

2 1 1

Empty requests data with multipart/form-data when using fetch api

It took me quite some time to resolve this isssue. It was an issue with formData and laravel/php not being able to detect the request payload when I dd or dump the request to check.

There is (and I believe) other solutions but I think this will save you the need to do "messy" workarounds.

Here you go:

DO NOT specify the Content-Type header yourself, when trying to make such a multipart request. That header needs to include the boundary value (so that the receiver will know how to parse this request) - if you specify it yourself, as just multipart/form-data, then that will be missing.

These…

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more