Unable to send formData in axios (react-native android)
Problem
I am making a POST request to "Cloudinary" server to upload an image and sending formdata using axios in react-native. The whole process is working fine on iOS but on android i am getting "Network Error". I am using axios 0.18.0 and stuck on this from last 3 days. Someone please help me. This issue has been faced by many people but there is no solution so far. My code: ` var photo = { uri: image.sourceURL, type: image.mime, name: image.filename, }; var formData = new FormData(); formData.append('file',photo); formData.append('upload_preset','abcde'); axios({ url:'https://api.cloudinary.com/v1_1/abcde/upload', method:'POST', headers:{ 'Content-Type':'application/x-www-form-urlencoded' }, data:formData }).then(function(response){ }).catch((error) =>{ //Network error comes in }); `
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Unable to send formData in axios (react-native android)
Just tried and it is still giving same error - " Error: Network Error". In the console log i am getting this: [code block]
Trust Score
6 verifications
- 1
Just tried and it is still giving same error - " Error: Network Error".
Just tried and it is still giving same error - " Error: Network Error".
- 2
In the console log i am getting this:
In the console log i am getting this:
Validation
Resolved in axios/axios GitHub issue #1567. Community reactions: 18 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep