elikem
6/25/2015 - 5:36 AM

S3 Uploader

S3 Uploader

# uses the 's3_uploader' gem
require 's3_uploader'

S3Uploader.upload_directory("#{Rails.root}/local_folder_to_upload/", 's3_bucket_name', {
                                                            :s3_key => Rails.application.secrets.aws_access_key_id,
                                                            :s3_secret => Rails.application.secrets.aws_secret_access_key,
                                                            :destination_dir => 'folder_on_s3/',
                                                            :region => 'us-east-1',
                                                            :threads => 4,
                                                            :metadata => { 'Cache-Control' => 'max-age=315576000' }
                                                        })