Hi Jeff,
here it is:
It throws “file: File is not an object” on $client->attachments->createOnTask(…)
BTW I found the reason: this example doesn’t work with PHP 7.0+ because of CURL ( CURLOPT_POSTFIELDS should not contain @ - see https://binfalse.de/2016/06/21/forget-the-at-use-curl-file-create/)
So, the next code works:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://app.asana.com/api/1.0/tasks/' . $taskId . '/attachments');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $apiToken]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, ['file' => new \CURLFile($pathToFile, $fileType, $fileName)]);
$data = curl_exec($ch);
Thanks!