Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'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!

like image 558
commandantp Avatar asked Sep 24 '15 15:09

commandantp


2 Answers

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);
like image 176
Simon Hughes Avatar answered Oct 18 '22 20:10

Simon Hughes


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.

like image 33
Adrian Crisan Avatar answered Oct 18 '22 21:10

Adrian Crisan