@mstdmstd I think you should do it via Storage
Storage::disk('cloudinary')->put('cl_filename.ext', Storage::disk('local')->get('local_filename.ext'));
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
In laravel 8 app I need to upload images from local storage into cloudinary ( with cloudinary-laravel 1.0)
and looking at description :
// Store the uploaded file in the "lambogini" directory on Cloudinary with the filename "prosper"
$result = $request->file->storeOnCloudinaryAs('lambogini', 'prosper');
How can I convert my storage path into uploaded request( $request->file ) ? uploaded request seems the obly oject which can work with methods of this library?
Thanks!
@mstdmstd I think you should do it via Storage
Storage::disk('cloudinary')->put('cl_filename.ext', Storage::disk('local')->get('local_filename.ext'));
Thanks!
I try to use your way, but I got error: This driver does not support retrieving URLs. having in env file:
CLOUDINARY_URL="cloudinary://XXXXXXXXXXX:XXXXXXXXXXXXX@cloudinaryname"
CLOUDINARY_UPLOAD_PRESET=ml_default
CLOUDINARY_NOTIFICATION_URL=
CLOUDINARY_ROOT_DIRECTORY=TAdsMedia
CLOUDINARY_API_KEY=XXXXXXXXXXX
CLOUDINARY_API_SECRET=XXXXXXXXXXXXX
CLOUDINARY_API_NAME=cloudinaryname
When I use cloudinary methods like storeOnCloudinaryAs, it works ok for me, but not storage methods. In config/filesystems.php I added lines :
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'cloudinary' => [// NOT SURE ARE THESE PARAMS VALID ?
'driver' => 'cloudinary',
'api_key' => env('CLOUDINARY_API_KEY'),
'api_secret' => env('CLOUDINARY_API_SECRET'),
'cloud_name' => env('CLOUDINARY_API_NAME'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
],
],
But clearing cache I have the same error anyway...
Is something wrong with my configurations and how can it be fixed?
composer.json :
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"arcanedev/log-viewer": "^8.1",
"arcanedev/no-captcha": "^12.2",
"cloudinary-labs/cloudinary-laravel": "^1.0",
"cviebrock/eloquent-sluggable": "^8.0",
"diglactic/laravel-breadcrumbs": "^6.1",
"drewm/mailchimp-api": "^2.5",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"jenssegers/agent": "^2.6",
"laravel/fortify": "^1.7",
"laravel/framework": "^8.12",
"laravel/sanctum": "^2.8",
"laravel/socialite": "^5.2",
"laravel/tinker": "^2.5",
"laravelcollective/html": "^6.2",
"league/flysystem-aws-s3-v3": "^1.0",
"league/geotools": "@stable",
"maatwebsite/excel": "^3.1",
"mailchimp/mailchimp": "^2.0",
"menarasolutions/geographer": "^0.3.10",
"mews/purifier": "^3.3",
"mobiledetect/mobiledetectlib": "^2.8",
"monarobase/country-list": "^3.2",
"pragmarx/countries": "^0.7.2",
"spatie/browsershot": "^3.40",
"spatie/emoji": "^2.2",
"spatie/geocoder": "^3.10",
"spatie/laravel-permission": "^4.0",
"stidges/laravel-country-flags": "^2.0",
"stripe/stripe-php": "^7.75",
"toin0u/geocoder-laravel": "^4.4",
"wboyz/laravel-enum": "^0.2.1",
"webpatser/laravel-uuid": "^3.0"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel-frontend-presets/tailwindcss": "^4.3",
"laravel/sail": "^1.0.1",
"laravel/telescope": "^4.4",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": [
"laravel/telescope"
]
}
},
"autoload": {
"files": [
"app/Library/helper.php"
],
"psr-4": {
"App\": "app/",
"Database\Factories\": "database/factories/",
"Database\Seeders\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
I try to debug source code and in file and opened file vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php:
and debugging url method, like :
public function url($path)
{
\Log::info( varDump($path, ' -1 url $path::') );
$adapter = $this->driver->getAdapter();
\Log::info( varDump($adapter, ' -1 url $adapter::') );
if ($adapter instanceof CachedAdapter) {
$adapter = $adapter->getAdapter();
\Log::info( varDump($adapter, ' -2 INSIDE url $adapter::') );
}
if (method_exists($adapter, 'getUrl')) {
return $adapter->getUrl($path);
} elseif (method_exists($this->driver, 'getUrl')) {
return $this->driver->getUrl($path);
} elseif ($adapter instanceof AwsS3Adapter) {
return $this->getAwsUrl($adapter, $path);
} elseif ($adapter instanceof Ftp || $adapter instanceof Sftp) {
return $this->getFtpUrl($path);
} elseif ($adapter instanceof LocalAdapter) {
return $this->getLocalUrl($path);
} else {
throw new RuntimeException('This driver does not support retrieving URLs.');
}
}
I see output
[2021-07-28 09:18:01] local.INFO: NULL : -1 url $path:: : NULL
[2021-07-28 09:18:01] local.INFO: (Object of CloudinaryLabs\CloudinaryLaravel\CloudinaryAdapter) : -1 url $adapter:: : Array
(
[cloudinary] => Cloudinary\Cloudinary Object
(
[configuration] => Cloudinary\Configuration\Configuration Object
(
[sections:protected] => Array
(
[0] => cloud
[1] => api
[2] => url
[3] => tag
[4] => responsive_breakpoints
[5] => auth_token
[6] => logging
)
[includeSensitive:protected] => 1
[cloud] => Cloudinary\Configuration\CloudConfig Object
(
[cloudName] => NNNNNNNNNNN
[apiKey] => XXXXXXXXXXXXXXXXXXX
[apiSecret] => WWWWWWWWWWWW
[oauthToken] =>
[explicitlySetKeys:protected] => Array
(
[cloudName] => 1
[apiKey] => 1
[apiSecret] => 1
)
)
[api] => Cloudinary\Configuration\ApiConfig Object
(
[uploadPrefix:protected] =>
[apiProxy] =>
[connectionTimeout] =>
[timeout:protected] =>
[uploadTimeout:protected] =>
[chunkSize:protected] =>
[callbackUrl] =>
[explicitlySetKeys:protected] => Array
(
)
)
as for Cloudinary Adapter method url not found and I can not manually edit file under “vendor/” it must be done in some other way?
Please or to participate in this conversation.