I need to send an image and some details as form-data in react-native
For that, I'm using axios
post method.
Here is my code:
const formData = new FormData();
formData.append('taskId', taskId);
formData.append('taskName', taskName);
formData.append('projectId', projectId);
formData.append('projectName', projectName);
formData.append('media', media);
const res = await Axios.post(`${URL}`, formData, {
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'multipart/form-data',
},
});
My server is getting media files as empty.. can anyone know what am I doing wrong here!?
PS: I. have tested on postman and its working fine over their