Monday, March 26, 2018

Laravel 5.5 – Transfer file to S3 - development

Laravel 5.5 – Transfer file to S3

I have an array of filenames that looks like this

array (
'file1.jpg',
'file2.jpg',
'file3.jpg'
)

I am trying to loop through them and upload them to an S3 bucket like this..

foreach ($filenames as $filename) {
    Storage::disk('s3')->put(

        /* S3 */
        's3foldername/' . $foldername . '/' . $filename,

        /* Local Storage */
        storage_path('localfolder/' . $foldername . '/' . $filename),
        'public'
    );
}

This isn’t working for some reason, the paths all check out ok. Do I need to read the file contents first?



from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-5-5-transfer-file-to-s3/
via Lzo Media

No comments:

Post a Comment