Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kvnkrft's avatar

Help with... Storage::disk('s3')->url($media->file);

I am trying to get the URL for a file I uploaded to s3 (using code).

Everything I'm reading indicates that this should work:

$media->path = Storage::disk('s3')->url($media->file);

But the url() method isn't valid.

Any ideas? I'm on Laravel 8/

0 likes
2 replies
Nakov's avatar

@kvnkrft what does an invalid url() means?

Do you have set the correct url in your config/filesystems.php file:

under s3 you should have:

'url' => env('AWS_URL'),

then in your .env file you should have the base pat to your S3 instance.

1 like
kvnkrft's avatar

Thanks for your reply.

I suppose it was just an issue with Visual Code, showing ->url() as invalid.

I was pretty sure I tested it, and it failed, but now it's working. Strange.

Please or to participate in this conversation.