file parameter documentation for the
POST /1/cards/[card id or shortlink]/attachments API call does not specify how the file should be encoded. For "Valid Values" it simply says "A file". I was wondering if anyone has a working example of how to get files into Trello cards using the API.
closed as off topic by phwd♦ Aug 27 '12 at 19:01
Questions on Web Applications Stack Exchange are expected to relate to web applications within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.
You should be able to add an attachment using the
multipart/form-data content type:
<form action="https://api.trello.com/1/cards/REPLACE_WITH_CARD_ID/attachments" method="POST" enctype="multipart/form-data"> <input type="hidden" name="key" value="REPLACE_WITH_YOUR_KEY" /> <input type="hidden" name="token" value="REPLACE_WITH_YOUR_WRITE_TOKEN" /> <input type="file" name="file"> <input type="submit" value="Upload"> </form>
(You don't necessarily have to be
POSTing from a webpage, but that's an easy example)