I've tried following ways but it just does not work while image is being uploaded through postman. What is my mistake?
export const updateProfile = data => dispatch => {
const {name, dateOfBirth, gender, customerId, phone, image} = data;
var bodyFormData = new FormData();
bodyFormData.append('image', image);
bodyFormData.append('name', name);
bodyFormData.append('dateOfBirth', dateOfBirth);
bodyFormData.append('gender', gender);
bodyFormData.append('customerId', customerId);
bodyFormData.append('phone', phone);
// bodyFormData.append('file', {
// uri: image,
// type: 'image/png',
// name: 'abc.png',
// });
axios({
url: `${baseUrl}/update-customer`,
method: 'POST',
data: bodyFormData,
headers: {'Content-Type': 'multipart/form-data'},
})
.then(function (response) {
console.log('updateProfile res', response.data);