Created
July 17, 2019 00:32
-
-
Save danielravina/cbed131d740f2b9a4f1abb834443cd97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def upload_stream(file_stream, file_format) | |
filename = "Report_#{@unit.serial_number}.#{file_format}" | |
s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION']) | |
obj = s3.bucket("flowlink-daily-reports-#{Rails.env}").object(filename) | |
obj.put(body: file_stream) | |
end | |
def upload_file(file_path) | |
s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION']) | |
obj = s3.bucket("flowlink-daily-reports-#{Rails.env}").object(File.basename(file_path)) | |
obj.upload_file(file_path) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment