how to upload base64 to server using formdata react native

Viewed 849

I have base64 of an image.. I want to send it to the api using formdata. How can that be achieved? I am using react native signature canvas to get the base64 of the signature.

let signature = base64signature;
const formdata = new FormData();
formdata.append('attachments', {
  uri: signature,
  name: 'logo',
  filename: 'logo',
  type: 'image/png',
});

How to convert Base64 String to javascript file object like as from file input form?
I followed this link as well but dont understand how to send it to the api as formdata.. It's constantly giving network error.

I have also tried to convert it to blob and send but that didn't work as well. Can anyone help me with this?

0 Answers
Related