jeudi 30 novembre 2017

Syntax to copy a file in Laravel (5.4) from local to AWS S3?

What's the best way to copy an uploaded file from my Laravel installation (running on Heroku) to S3? I can't do a direct to S3 upload, as it's an image that I'm locally generating a thumbnail for. I also don't want to use any extra libraries etc. (sledgehammer to crack a nut etc.). File needs to go in a particular folder in my S3 bucket. Is this the only/best way? :-

Storage::disk('s3')->put('S3_folder_name/file.jpg', file_get_contents('my_local_file.jpg'));

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire