question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

formData is empty on serverside

See original GitHub issue

I’m trying upload a zip file along with form data. The data is being sent successfully but the formData is empty on serverside.Since I could not find the answer in the StackOverflow or any forums.I’m posting the issue here.Here is my code. var formData = new FormData(); formData.append('modelfile', values.values.modelfile[0]); return axios.post('http://127.0.0.1:8000/addProduct',formData, { headers: {'Content-Type': 'multipart/form-data' }} ) .then(res=>dispatch({type:'PRODUCT_UPLOADED_SUCCESSFULLY'})) .catch(error=>dispatch({type:'PRODUCT_UPLOADED_FAILED'})) screenshot of send request desktopconsole

https://stackoverflow.com/questions/48561688/axios-file-post-receiving-empty-array-at-server-side

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ghostcommented, Aug 3, 2018

Same problem, the server received an empty object.

0reactions
chinesedfancommented, Sep 12, 2020

Closed due to stale. Feel free to open a new issue if it is still there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using FormData object, the server receives an empty POST
I'm attempting to send one file and one text variable to my server with the FormData object. Looking at the Network tab in...
Read more >
JavaScript - FormData initialized from a form element is empty
When you initialize FormData() from a form element, it'll only map input fields that have a name attribute. Only these mapped input fields...
Read more >
Sending form data - Learn web development | MDN
Because the body is empty, if a form is sent using this method the data sent to the server is appended to the...
Read more >
ServerSide $_POST is empty — DataTables forums
That's weird - your inspector's output shows that the POST is being sent with form data, so the problem must be with the...
Read more >
Can't upload a file from node.js to my route, getting empty ...
However doing a simple post request, it does arrive at the server. So something must be wrong with my formData... Copy Code axios.post(`https://www.myapp....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found