One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
lenner90
7 years agoExplorer | Level 3
From where i can get image from user dropbox and display on browser
which api should i use to get image stored in user's dropbox .
i tried using /download using php
curl -X POST https://content.dropboxapi.com/2/files/download \ --header "Authorization: Bearer " \ --header "Dropbox-API-Arg: {\"path\": \"/Homework/math/Prime_Numbers.txt\"}
$result=$processDB->getData($sql); $api_url = 'https://content.dropboxapi.com/2/files/download'; //dropbox api url $filename = $_FILES["file"]['tmp_name']; $headers = array('Authorization: Bearer '. $result[0]['token'], 'Content-Type: application/octet-stream', 'Dropbox-API-Arg: '. json_encode( array( "path"=> $value['path'] ) ) ); $ch = curl_init($api_url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($response.'<br/>'); echo($http_code.'<br/>'); curl_close($ch);
this the code i using.
but response all unknow code. Am i using the correct api ? or any better way.
- Greg-DB
Dropbox Staff
The /2/files/download endpoint is the correct way to retrieve the original file data for a file in the connected user's account. The response is the raw file data itself. You can use that however you want, e.g., save it to your server and serve it back to the user in your web app. If you don't want or need the original file data (the full image quality), you can use /2/files/get_thumbnail instead, which works the same way.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 14 hours ago
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!