简体   繁体   中英

'Cloud' filesystem storage does not work - Laravel 5.1

I am trying to save in the 'cloud' some files.

Using: Storage::disk('local')->put('filename', $file) works.

Using 's3' disk also works: Storage::disk('s3')->put('filename', $file)

BUT

when trying 'cloud': Storage::disk('cloud')->put('filename', $file) it returns the following error:

BadMethodCallException in PluggableTrait.php line 85: Call to undefined method League\Flysystem\Filesystem::createDriver

Any idea why and how to fix it?

Thanks!

Two years late to the party, but to help those that might find this post as I did. I believe what you want is...

Correct, only if you have a disk named 'cloud'.

$url = Storage::disk('cloud')->put('filename', $file);

Else; this uses the disk matching the name entered in config('filesystem.cloud') .

$url = Storage::cloud()->put('filename', $file);

If you are using this into a controller, what you should do is:

use Illuminate\Contracts\Filesystem\Cloud;

......

public function test(Cloud $cloud) {
    $cloud->...
}

Hope this helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM