带有S3的存储磁盘URL给我错误的S3 URL

时间:2019-04-21 08:57:53

标签: laravel-5 amazon-s3

使用s3的存储磁盘URL给我错误的s3 url

我正在使用Laravel的Filesystem在s3上存储项目,但URL却不正确。

request->file('company_logo')->store('library');

工作良好

当引荐网址s3给我错误的s3网址

Storage::disk()->url($path_company_logo);

转售

此网址

http://alumni-club-files.s3-us-east-1.amazonaws.com/library/DyawVxh2XI82qV9b91d2sZHuwRVeUEIu8Vp8PRu2.png

应该是

http://alumni-club-files.s3.amazonaws.com/library/DyawVxh2XI82qV9b91d2sZHuwRVeUEIu8Vp8PRu2.png

config / filesystem.php


        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
        ],

.env


S3_KEY=MYKEY
S3_SECRET=mySecr3tmySecr3tmySecr3tmySecr3t
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=alumni-club-files
AWS_URL=http://alumni-club-files.s3-us-east-1.amazonaws.com

我尝试了


S3_KEY=MYKEY
S3_SECRET=mySecr3tmySecr3tmySecr3tmySecr3t
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=alumni-club-files
AWS_URL=http://alumni-club-files.s3.amazonaws.com


S3_KEY=MYKEY
S3_SECRET=mySecr3tmySecr3tmySecr3tmySecr3t
AWS_DEFAULT_REGION=
AWS_BUCKET=alumni-club-files
AWS_URL=http://alumni-club-files.s3.amazonaws.com

同样的问题

1 个答案:

答案 0 :(得分:0)

我已经解决了问题

文件.env

使用

if manufacturerCompleted
    && modelCompleted
    {
        let image = UIImage(named: "tick")
        self.tabBarItem.image = image?.withRenderingMode(.automatic)
    }

装有

AWS_URL=http://alumni-club-files.s3.amazonaws.com

关闭服务器并重新运行

AWS_URL=http://alumni-club-files.s3-us-east-1.amazonaws.com

正在工作