formData is empty on serverside
See original GitHub issueI’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
https://stackoverflow.com/questions/48561688/axios-file-post-receiving-empty-array-at-server-side
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:8 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same problem, the server received an empty object.
Closed due to stale. Feel free to open a new issue if it is still there.