mstdmstdd Posted December 22, 2017 Share Posted December 22, 2017 Hello,In laravel 5.5 application I need to upload file to dropbox and get shared link to this file.I used DropboxAdapter library and this doc https://murze.be/dropbox-will-turn-off-v1-of-their-api-soon-its-time-to-update-your-php-applicationAnd looking at this dochttps://laravel.com/docs/5.5/filesystem#retrieving-filesI managed to put a file to dropbox storage ok, but failed to get its url.I did like : $exists = Storage::disk('dropbox')->exists($dest_dropbox_file_name); echo '<pre>$exists::'.print_r($exists,true).'</pre>'; // Value is 1 $url = Storage::disk('dropbox')->url($dest_dropbox_file_name); echo '<pre>$url::'.print_r($url,true).'</pre>'; I got error: RuntimeException This driver does not support retrieving URLs. Which is the right way to get shared url of uploaded filr to dropbox?Who used this library ?Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/305959-to-get-shared-link-to-the-file-uploaded-to-dropbox-with-laravel/ Share on other sites More sharing options...
gizmola Posted December 22, 2017 Share Posted December 22, 2017 I assume you followed the instructions in the Murze blog post. Did you run a composer update after you altered the composer.json? If that is not the problem we really will need to see some code. Quote Link to comment https://forums.phpfreaks.com/topic/305959-to-get-shared-link-to-the-file-uploaded-to-dropbox-with-laravel/#findComment-1554840 Share on other sites More sharing options...
mstdmstdd Posted December 24, 2017 Author Share Posted December 24, 2017 Yes, I run composer update and followed this article and in my model: <?php namespace App; use Illuminate\Database\Eloquent\Model; use Auth; use Intervention\Image\Facades\Image as Image; use Carbon\Carbon; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Storage; use League\Flysystem\Filesystem; use Spatie\Dropbox\Client; use Spatie\FlysystemDropbox\DropboxAdapter; ... class TmpCsvp extends MyAppModel { ... public static function setToIsApplied($id,bool $to_copy, $to_employee_id) { ... $dropboxClient = new Client(env('DROPBOX_OATH')); $adapter = new DropboxAdapter($dropboxClient); $filesystem = new Filesystem($adapter); echo '<pre>$filesystem::'.print_r($filesystem,true).'</pre>'; // The output is League\Flysystem\Filesystem Object class echo '<pre>$dropboxClient::'.print_r($dropboxClient,true).'</pre>'; // The output is Spatie\Dropbox\Client Object $uploaded = $filesystem->put($dest_dropbox_file_name, $file, []); echo '<pre>$uploaded::'.print_r($uploaded,true).'</pre>'; // The output is 1 $exists = Storage::disk('dropbox')->exists($dest_dropbox_file_name); echo '<pre>$exists::'.print_r($exists,true).'</pre>'; $url = Storage::disk('dropbox')->url($dest_dropbox_file_name); // THAT LINE RAISE EXCEPTION echo '<pre>$url::'.print_r($url,true).'</pre>'; That is error page output: https://imgur.com/a/HpE4M But file was uploaded to the directory/filename in $dest_dropbox_file_name like “docs/-doc-130/lender_image_1.jpg” My composer.json : { "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "php": ">=7.0.0", "doctrine/dbal": "^2.5", "fideloper/proxy": "~3.3", "intervention/image": "^2.4", "laravel/framework": "5.5.*", "laravel/tinker": "~1.0", "maatwebsite/excel": "~2.1.0", "mcamara/laravel-localization": "^1.3", "rcrowe/twigbridge": "^0.9.5", "sebastiansulinski/dotenv": "^2.0", "sebastiansulinski/php-backup": "^2.0", "spatie/flysystem-dropbox": "^1.0", "spatie/laravel-backup": "^3.0.0" }, "require-dev": { "filp/whoops": "~2.0", "fzaninotto/faker": "~1.4", "mockery/mockery": "~1.0", "phpunit/phpunit": "~6.0" }, "autoload": { "classmap": [ "database/seeds", "database/factories" ], "psr-4": { "App\\": "app/" } }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "extra": { "laravel": { "dont-discover": [ ] } }, "scripts": { "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate" ], "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover" ] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true } } What wrong in my configuraion/code? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/305959-to-get-shared-link-to-the-file-uploaded-to-dropbox-with-laravel/#findComment-1554861 Share on other sites More sharing options...
mstdmstdd Posted January 11, 2018 Author Share Posted January 11, 2018 Hello,I still search for a decision, as I still have an error: This driver does not support retrieving URLs. when I try to get shared url of uploaded file.I created a small application, repeating the error I have.Public url:https://www.dropbox.com/s/rmclue63tyeyu1w/dropbox_demo.zip?dl=0Under http://127.0.0.1:8000/ url there is “Run drop box” menu item and clicking on it the routing would be run.I output to the console all related variables.I hardcoded app's key/secret in the HomeController.php and in the config/app.php files.If there is no error in the code,please, try to run under your dropbox creditials. Could it be misconfiguration on dropbox side of my account?Thank you for your time! Quote Link to comment https://forums.phpfreaks.com/topic/305959-to-get-shared-link-to-the-file-uploaded-to-dropbox-with-laravel/#findComment-1555218 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.