ctaljaardt's avatar

S3 Visbility For images

Hello.

I have made it where a user can upload a profile picture, the problem is that the image's visibility is alwyas set to owner and therefore other cannot view the image becuase you get an accessed denied.

how would i pass the ACL public-read to amazon with the file to make it publicly visable?

0 likes
2 replies
ctaljaardt's avatar

i tried passing it as an array in the query but it just gave me errors :/

ctaljaardt's avatar

Here is my Controller to Upload the image

    public function postChangeImg(Request $request, Filesystem $filesystem)
    {            
        $user = User::where('email', $request->user());
        $file = Input::file('file');
        if ($file->getMimeType() != "image/jpeg" && $file->getMimeType() != "image/png") {
            dd('error1');
        } else {
            $ext = "." . explode(".", $file->getClientOriginalName())[1];
        }
        $filesystem->put('/profile/avatar/' . $request->user()->id . $ext, file_get_contents($file));
        dd('done');
    }

Please or to participate in this conversation.