Hello
I am trying to upload a file using cURL through php. Here is the code I am using.
$tmpPathName = ‘D:\xampp\tmp\php15AF.tmp’;
$getType = ‘image/png’;
$cfile = new \CURLFile($tmpPathName, $getType, ‘image’);
$postfields = array(“filedata” =>$cfile);
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, 'https://api.backendless.com/xxxx/yyyy/files/Restaurant/image.png/?overwrite=true');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: multipart/form-data')
);
$result = curl_exec($curl);
curl_close($curl);
echo '<pre>';
print_r($result);
But I keep getting "No any response (it’s showing blank).
What is it that I am doing wrong here ?
Thanks