commandantp
commandantp

Reputation: 967

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

Upvotes: 7

Views: 4103

Answers (2)

Simon Hughes
Simon Hughes

Reputation: 91

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);

Upvotes: 9

Adrian Crisan
Adrian Crisan

Reputation: 76

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.

Upvotes: 1

Related Questions