Can't upload Attachment through API

Can't upload Attachment through API

Hi.

I'm trying to upload attachments to my contacts in zoho CRM through API. I use a form where the user can upload files an I use this curl code to put that attachment to zoho:

$curlFiles = curl_init();

curl_setopt($curlFiles, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlFiles, CURLOPT_URL, ' https://www.zohoapis.eu/crm/v2/contacts/' . $recordId . '/Attachments');
curl_setopt($curlFiles, CURLOPT_HTTPHEADER, array('Authorization: Zoho-oauthtoken ' . $accessToken));
curl_setopt($curlFiles, CURLOPT_POSTFIELDS, $files);
curl_setopt($curlFiles, CURLOPT_POST, 1);

$respFiles = json_decode(curl_exec($curlFiles));

curl_close($curlFiles);

The $files Array looks like this:

array(1) {
  ["file"]=>
  string(15) "@/tmp/phpBBaGjc"
}

and I get a response as follows:

object(stdClass)#1 (4) {
  ["code"]=>
  string(15) "INVALID_REQUEST"
  ["details"]=>
  object(stdClass)#7 (1) {
    ["expected_type"]=>
    string(22) "Multipart Form Request"
  }
  ["message"]=>
  string(15) "invalid request"
  ["status"]=>
  string(5) "error"
}

What am I doing wrong? I also tried to set the content type to multipart/form-data within the header but that also doesn't work. Any ideas?

Greetings
Marco