Cut the Clutter: Test Ignore Files Feature - sign up to become a beta tester here.

Forum Discussion

ws's avatar
ws
New member | Level 2
9 years ago

Upload Image with Dropbox API

Hi,

When Iam uploadinh the image using the curl code.The response is 200 ok,but when iam viewing the image in the dropbox .It says unable to preview this type of images.My code is:

 

 

$fields ='@'.'test.jpg';
$headers = array("Authorization: Bearer ".$token,'Content-Type: application/octet-stream', 'Dropbox-API-Arg: {"path":"/arun/teshhhhht.jpeg","autorename": true,"mute": false,"mode":"add"}');
$ch = curl_init('https://content.dropboxapi.com/2/files/upload');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);;
$rest1=json_decode($response,true);
echo "<pre>";
print_r($response);

1 Reply

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,037 PostsLatest Activity: 24 hours ago
413 Following

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!