Store the S3 URL in the database table

0

I'm developing an application where I upload and files to AWS S3, just images.

if($request->hasFile('cover')){
            $file = $request->file('cover');
            $name = time().$file->getClientOriginalName();

            $filepath = 'programs/cover/'.$name;
            Storage::disk('s3')->put($filepath, file_get_contents($file), 'public');
        }

Image is going to the path of S3, when that in the database appears to me this.

Postman testing.

path: "/tmp"
    filename: "phpqtaO5v"
    basename: "phpqtaO5v"
    pathname: "/tmp/phpqtaO5v"
    extension: ""
    realPath: "/tmp/phpqtaO5v"

I want to be able to save the link of the image that was to S3 in my database, so that in the view I can load it.

    
asked by anonymous 05.10.2018 / 19:41

0 answers