Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Burak_Cayir
8 years agoExplorer | Level 3
I can't download my files with PHP Core API
I have a Dropbox basic account, and these are my download codes. But I cant download my files with core API. Please help me .
require_once "lib/Dropbox/autoload.php";
use \Dropbox as dbx;
$appInfo ...
Burak_Cayir
8 years agoExplorer | Level 3
Ok , I revoked API. When I continue with my codes , I get this error.
Fatal error: Uncaught InvalidArgumentException: 'accessToken' invalid: contains invalid character in C:\xampp\htdocs\17subat\lib\Dropbox\Client.php:1473 Stack trace: #0 C:\xampp\htdocs\17subat\lib\Dropbox\Client.php(78): Dropbox\Client::checkAccessTokenArg('accessToken', '<ACCESS_TOKEN>') #1 C:\xampp\htdocs\17subat\indirme.php(118): Dropbox\Client->__construct('<ACCESS_TOKEN>', 'PHP-Example/1.0') #2 {main} thrown in C:\xampp\htdocs\17subat\lib\Dropbox\Client.php on line 1473
Fatal error: Uncaught InvalidArgumentException: 'accessToken' invalid: contains invalid character in C:\xampp\htdocs\17subat\lib\Dropbox\Client.php:1473 Stack trace: #0 C:\xampp\htdocs\17subat\lib\Dropbox\Client.php(78): Dropbox\Client::checkAccessTokenArg('accessToken', '<ACCESS_TOKEN>') #1 C:\xampp\htdocs\17subat\indirme.php(118): Dropbox\Client->__construct('<ACCESS_TOKEN>', 'PHP-Example/1.0') #2 {main} thrown in C:\xampp\htdocs\17subat\lib\Dropbox\Client.php on line 1473
Greg-DB
Dropbox Community Moderator
8 years agoAre you running the version with "<ACCESS_TOKEN>", or did you just redact your access token like that for posting the error here?
That's not a valid access token, and since you revoked the app, you'll need to retrieve a new access token to run your code. Make sure you use your access token exactly as provided, that is, just the long string without < or >.
That's not a valid access token, and since you revoked the app, you'll need to retrieve a new access token to run your code. Make sure you use your access token exactly as provided, that is, just the long string without < or >.
- Burak_Cayir8 years agoExplorer | Level 3What is the difference between new and old access tokens ? Why I should take a new one ? Old token perfectly uploaded my files but didnt download any file . I should try new access token ? Please let me know can all users upload files and download files with my Dropbox basic account ? I respect your business but I am going to crazy . I think I will delete my dropbox account :(
- Greg-DB8 years ago
Dropbox Community Moderator
By new access token, I mean you should retrieve another. This won't be any different that the old one, except that the old one is now revoked.
It is important that the old one was revoked because you posted it publicly, meaning any person could have taken it and accessed your account.
Once you have a working access token again, let us know the error message you get when you try to download a file. (Just don't post the new access token itself.)- Burak_Cayir8 years agoExplorer | Level 3
Ok , I got a new token and I can use it. I can upload any file or I can list my dropbox files. But I cant download my files. I am adding codes again without access token.
require_once "lib/Dropbox/autoload.php"; use \Dropbox as dbx; $appInfo = dbx\AppInfo::loadFromJsonFile("app-info.json"); $webAuth = new dbx\WebAuthNoRedirect($appInfo, "PHP-Example/1.0"); $authorizeUrl = $webAuth->start(); $accessToken = '<ACCESS_TOKEN>'; //secret $dbxClient = new dbx\Client($accessToken, "PHP-Example/1.0"); $f = fopen("tufek.jpg", "w+b"); $fileMetadata = $dbxClient->getFile("/tufek.jpg", $f); /*I cant download*/ fclose($f); print_r($fileMetadata); $metaData = $dbxClient->getMetadataWithChildren("/"); foreach($metaData['contents'] as $file){ // I can list my files $f = str_replace("/", "", $file['path']); echo "<div style='text-align:center; margin-top:25px;'><li>$f</li></div>"; }
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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, Facebook or Instagram.
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!