I am unable to send media files especially images(jpeg) using the Clickatel One API.
However, text messages are being delivered.
Below is my code snippet for sending the file: (PHP)
$header = [
'Authorization: ' . $clickatel_api_key,
'Content-Type: image/jpeg'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, 'https://platform.clickatell.com/v1/media?fileName=' . $name . '&to=254712345678');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $file);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
return $result;
Below is the response from the request:
{"error":null,"fileId":"2eee5d0eee4fc4f42943e47c06f12345fdss2ddd.jpg","accepted":true}
The media file is not delivered.