Uploading Attach File to Zoho Desk Ticket

Uploading Attach File to Zoho Desk Ticket

Hi Zoho,

Now I'm trying to upload file to a specific ticket, but the code still missing some data, I can't get it:

 $path='uploads';
        $filename='123.jpg';
        $fullPath=$path."/".$filename; 
        $fields = array(
        'filename' => $filename,
        'content' => curl_file_create ($fullPath)
        );
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
 CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\"".$_FILES['uploads']['tmp_name']."\"\r\nContent-Type: ".$_FILES['uploads']['type']."\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
  CURLOPT_HTTPHEADER => array(
    "Authorization: ----------------------------------------",
    "Cache-Control: no-cache",
    "Connection: keep-alive",
    "Content-Type: application/x-www-form-urlencoded",
    "Host: desk.zoho.com",
    "cache-control: no-cache",
    "content-type: multipart/form-data;",
    "orgId: ------------"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);