Reputation: 95
I am uploading a file to S3 and specifying a bucket. When I check my S3 dashboard, it's in the right place and right bucket (s3-legacy-users
). But when I go to retrieve the URL, the bucket is not s3-legacy-users
but a different bucket. Is there a way to specify the bucket when using Storage::url()
?
$file = $request->file('file');
$fileName = $file->hashName();
$image = Image::make($file->getRealPath());
$newPath = '/'.shop_id().'/'.$imageType.'-'.$fileName;
$fileUpload = Storage::disk('s3-legacy-users')->put($newPath, $image->stream()->__toString());
$filePath = Storage::url($newPath);
dd($filePath);
Upvotes: 1
Views: 543
Reputation: 2951
You need to specify your disk if you have several storage drivers:
$filePath = Storage::disk('s3-legacy-users')->url($newPath);
Upvotes: 1