Get file's signed URL from amazon s3 using Filesystem Laravel 5.2

后端 未结 4 605
南旧
南旧 2021-01-30 10:55

I\'m looking for a good solution to get the signed url from amazon s3.

I have a version working with it, but not using laravel:



        
4条回答
  •  情歌与酒
    2021-01-30 11:46

    For Laravel 5.5 and up, you can now use temporary URLs/s3 presigned URL.

    use \Storage;
    
    // Make sure you have s3 as your disk driver
    $url = Storage::disk('s3')->temporaryUrl(
       'file1.jpg', Carbon::now()->addMinutes(5)
    );
    

    This only works for s3 storage driver AFAIK.

    https://laravel.com/docs/5.5/filesystem#retrieving-files

提交回复
热议问题