Matheeus's avatar

Laravel S3 Storage put returns boolean instead of path

Hello, I'm using DigitalOcean Spaces (S3 compatible) for storing my Laravel's app file.

Now I'm trying to make a .txt file inserting in it a text, with this code:

$file = Storage::disk('digitalocean')->put('generated-file/'.$title.'.txt', $content); return $file;

But instead of the path of the file, I get a boolean, so when I try to get the complete url with this method: Storage::disk('digitalocean')->url($file);

I'm getting a wrong URL. How I can achieve what I want to do? (Make a new txt file, don't upload an existing one, and getting his public url on the object storage).

0 likes
3 replies
bait-dept's avatar

What is the value of $file when checking for the URL?

If it returns boolean im assuming you're doing something like Storage:: ... ->url(true)?

Snapey's avatar

I guess it assumes you know the filename since you specified it.

storeAs would return the auto generated filename.

Please or to participate in this conversation.