Experiencing difficulty trying to successfully add an attachment to a task using cURL/PHP.
$data = array("file" => "@$filename");
$headers = array("Authorization: Basic " . base64_encode($asana_api_key) . ":"));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://app.asana.com/api/1.0/tasks/$task_id/attachments");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_exec($ch);
Assume $filename, $asana_api_key, and $task_id are set properly. Should be fairly straightforward... but for some unknown reason I get the following response:
{"errors":[{"message":"Server Error","phrase":"19 snobby warthogs cheer busily"}]}
Oddly enough, running this request using curl command line works perfectly. I've tinkered with this for hours now to no avail.
Any ideas as to what the issue may be?