0

I'm trying to add some functionality to an internal Access database that will automatically create tasks on Asana. My VBA experience is somewhat limited but by examining various code samples online and tinkering I've been able to POST tasks with all the necessary data and GET info back. But I'm now struggling with being able to upload file attachments to a task. I'm not sure how to go about it.

Leaving the content type as application/x-www-form-urlencoded which works for the normal POST statements when creating tasks and just pointing the send command to a file location using doesn't work and results in an error of "file is not an object", I'm guessing this is because all that's contained in the send command is a file=path pair.

Do I need to encode the file at all, if so how?

I'm hoping someone can point me in the right direction.

Thanks.

Erik A
  • 31,639
  • 12
  • 42
  • 67

1 Answers1

0

You can check out how curl does it, but I believe it needs to be multipart/form-data - I would strongly recommend using a library rather than doing the encoding manually, since there are often subtle gotchas.

Basically, it works a lot like a standard form upload from a web browser.

Hope that helps!

agnoster
  • 3,744
  • 2
  • 21
  • 29