Base64 Upload of Attachments

Hello,

I’m trying to upload an attachment to a file using the /attachments endpoint. If I send my file using your API docs, it uploads fine. If I then copy your Javascript example and execute it, it results in a “File is not an object” Error. Could you provide us with a working example?

const form = new FormData();
form.append('resource_subtype', 'asana');
form.append('file', 'data:application/pdf;name=test.pdf;base64,${data}');
form.append('parent', gid);

const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    authorization: 'token'
  }
};

options.body = form;

fetch('https://app.asana.com/api/1.0/attachments', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

an attachment to a task*