Asana API Adding an Attachment via cURL/PHP -
experiencing difficulty trying add attachment 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, , $task_id set properly. should straightforward... unknown reason following response:
{"errors":[{"message":"server error","phrase":"19 snobby warthogs cheer busily"}]}
oddly enough, running request using curl command line works perfectly. i've tinkered hours no avail.
any ideas issue may be?
this bug on our end, , should fixed. had way curl sending filename, namely, entire path file. browsers typically send basename (without directory). apply same logic ourselves if full path our local name, , seems works, case may different.
i'd appreciate knowing if works now.
Comments
Post a Comment