12. Sending images #

Created Sat Dec 30, 2023 at 1:55 PM

Payload creation #

const payload = new FormData();

payload.append('name', 'Sanjar');
payload.append('age', 25);

imgArray.forEach((img, index) => {
  payload.append('images', {
    name: 'img' + idx, // this is enough to indcate that `images` is an array
    type: `image/jpeg`,
    uri: img // as returned by picker
  })
});

axios.post('/endpoint-here', payload, { params: {} });