Created
April 16, 2015 00:06
-
-
Save amitnarayanan/6704c2d0334e0e3fa4de to your computer and use it in GitHub Desktop.
Pseudo code for uploading attachments to AWS S3
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
# if there are attachments... | |
if @email.attachments.present? | |
# ...loop over each one... | |
@email.attachments.each do |attachment| | |
# ... and upload to storage provider | |
response = storage.put_object($BUCKET_NAME, # S3 bucket | |
attachment.original_filename, # filename | |
attachment, # the ActionDispatch::Http::UploadedFile object returned by Griddler | |
$OPTIONS # things like Content-Type headers, S3 acl go here | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment