jeudi 21 mai 2020

Laravel: Storage::url() returning wrong bucket

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


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire