Answer the question
In order to leave comments, you need to log in
How to send an array of data to the server?
const send = new FormData();
ImageResizer.createResizedImage(image, 600, 600, 'JPEG', 100)
.then((res) => RNFS.readFile(res.uri, 'base64'))
.then((res) => {
let string = 'data:image/jpeg:base64,'.concat(res);
send.append('link', string);
send.append('tags', listTags); // === ['array','array','array']
console.log(send)
return axios.post('https://', send)
})
.then((res) => {
const array = Object.values(res.data)
categoryList(array);
})
navigation.navigate('Category')
}
Answer the question
In order to leave comments, you need to log in
No transformation
...
send.append('link', string);
listTags.forEach(tag => send.append('tags[]', tag);
console.log(send)
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question