Axios don't send form data in react-native
See original GitHub issueI’ve try to send a form data with axios but i can’t, in chrome dev tools no content appears in the request. Making a same request via postman the API response normally.
(newData) => {
const data = new FormData();
data.append('name', 'raphael');
data.append('file', {
uri: newData.image.path,
type: 'image/jpeg',
name: 'teste'
});
return axios.post(`${constants.development.URL_API}/file`, data,
headers: {
'Content-Type': 'multipart/form-data',
},
})`
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:46 (4 by maintainers)
Top Results From Across the Web
react native post form data with object and file in it using axios
second problem is axios converts form data automatically to string, so you need to use transformRequest config on request to override it. import ......
Read more >Steps to Send Form Data Using Axios Post Request in React
Here is the step-by-step guide to send form data using axios post request in React. Refer this article if you need this step-by-step...
Read more >How to post form data with axios - LearnBestCoding
1. Install axios in your React project. If you haven't installed axios yet, you can run the below command to install axios. npm ......
Read more >POST form data using Axios API in JavaScript (including a file)
Source code: https://openjavascript.info/2022/08/03/ post - form - data -using- axios /⚡ Looking for high-performance, affordable web hosting for ...
Read more >How to post form-data with axios : r/reactnative - Reddit
I've been trying to post form-data but always get error. please help me solve it. here is Stackoverflow question in details.
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
Y’all, I appreciate the direction but “just test a file upload in React Native” isn’t that easy. I don’t often work in React Native and it would take a decent amount of time to spin up a project with file uploads to test with.
I do have a simple POST with form data that works in React Native:
true
gets stringified when sent to the server, which is interesting.That said, if anyone can provide an example that I can easily spin up, I’m happy to look into it more.
This bug still happens with latest axios, why was this closed?