CURL rest file upload API

Hi, I’m struggling with the following CURL API call in php :

$url =“https://api.backendless.com/v1/files/event-101/test.txt?overwrite=true”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$headers = array();
$headers[] = “application-id:8ADBE323-B8EC-05D7-FFB0-86AC68B77F00”;
$headers[] = "secret-key: ??? ";
$headers[] = “Content-Type:multipart/form-data”;
$headers[] = “application-type:REST”;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘POST’);
curl_setopt($ch, CURLOPT_POSTFIELDS,“upload:@/Users/danielthomason/Documents/proxumi/test.txt”);
echo ‘</br>Got here 2</br>’;
$resp = curl_exec($ch);
var_dump(json_decode($resp, true));
$data = json_decode($resp, true);
echo ‘</br></br></br>print_r resp</br></br></br>’;
print_r ($resp);
echo ‘</br></br></br>print_r data</br></br></br>’;
print_r ($data);
echo ‘</br>Got here 3</br>’;
curl_close($ch);
echo ‘</br>Got here 5</br>’;

When executed, back endless responds with the URL of the uploaded file, however the file itself is never uploaded. Can someone verify I’m setting up the CURL call correctly?

Many thanks, Dan.

Using CURL from PHP to upload a file seems like an overkill. Have you tried the API available in our SDK:

https://backendless.com/documentation/files/php/files_file_upload.htm