Hello ! I want to upload an image (test.png) from the root of my site to my Dropbox but it doesn't work. My php script is in the same folder than image test.png :
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://content.dropboxapi.com/2/files/upload");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$post = array(
"file" => "@ .realpath(test.png")
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = "Authorization: Bearer MY_BEAUTIFUL_TOKEN";
$headers[] = "Dropbox-Api-Arg: {\"path\": \"/test.png\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}";
$headers[] = "Content-Type: application/octet-stream";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$curl_response_res = curl_exec ($ch);
echo $curl_response_res; // Server response
print_r(curl_getinfo($ch)); // Http Response
curl_close($ch);
fclose($fh_res);
What is the problem ?