Forum Discussion

HiteshKumar's avatar
7 years ago

Upload multiple attachment using REST API V1

I am using message/post API to post a message. Below are the params which I am passing while creating a new message.

I am using PHP curl for this. 

Below is my code which is working fine for single attachment. However, I don't know how can I upload multiple attachments. 

 

$param = array(
   'message.subject' => 'Message Subject',
   'message.body' => 'Message Body',
   'message.upload' => 'C:\xampp\htdocs\dd\test.jpg'
);
$cFile = curl_file_create($param["message.upload"]);
$param["message.upload"] = $cFile;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$this->curl_url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$result = curl_exec($ch);
No RepliesBe the first to reply