'How to upload image in react native using axios, nodejs server
react native 0.67.3 I try to use axios upload image to nodejs server but it not work for me. it send 404 status code all the time
const formData = new FormData()
formData.append('Id', id)
formData.append('file', {
name: nameFile,
type: typeFile,
uri: Platform.OS === 'ios' ? uriFile.replace('file:', '') : uriFile,
})
formData.append('Create', moment(Create).format('YYYY-MM-DD HH:mm:ss'))
formData.append('ResultId', Result)
await axios({
method: 'post',
url: 'localhost',
headers: 'authen',
data: formData,
})
.then(res => {
console.log(res)
})
.catch(err => {
console.log(err)
})
[Error: Request failed with status code 404]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
