从S3 laravel下载文件不起作用

时间:2018-07-22 12:42:36

标签: php laravel amazon-s3

我试图用laravel下载文件,但一直收到未找到的消息。我尝试了很多东西,而我做的最后一件事是:

public function download($id)
{
    $allowed_guards = ['managers', 'staff'];

    if (!$this->autherize($allowed_guards))
    {
        response()->json(['error' => 401], 200);
    }

    $this->user = Auth::guard($this->guard)->user();

    $asset = FileForAssignment::find($id);

    $assetPath = Storage::disk('s3')->url($asset->path);



    return response()->download(storage_path($assetPath));
}

0 个答案:

没有答案