1

Laravel 5.7. My default filesystem is set to S3:

config/filesystems.php

'default' => env('FILESYSTEM_DRIVER', 's3'),

I am able to upload to S3 with this configuration. But when I use the url method to retrieve the full URL, I only get a relative URL back:

return Storage::url($folder . '/' . $this->src);

returns /image/filename.jpg. What I expect is the full path to the S3 bucket + filename.

3
  • Did you set 'url' in your S3 driver for filesystems.php? Commented May 12, 2019 at 15:32
  • Storage::url($this->src); try this.. in filesystem already refer to the bucket you already setup.. Commented May 12, 2019 at 16:05
  • @senty You pointed me in the right direction. I had AWS_URL= (i.e. pointing to nothing) in my .env file. I just removed that key and it worked. If you want to write that as an answer I can mark it as correct. Commented May 12, 2019 at 16:30

1 Answer 1

2

The url parameter in filesystem.php should be pointed to make Storage::url($path) to work.

As you pointed out (which I didn't realise), AWS_URL is present in .env, and it should be pointed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.