Skip to content

Instantly share code, notes, and snippets.

@amitnarayanan
Created April 16, 2015 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitnarayanan/6704c2d0334e0e3fa4de to your computer and use it in GitHub Desktop.
Save amitnarayanan/6704c2d0334e0e3fa4de to your computer and use it in GitHub Desktop.
Pseudo code for uploading attachments to AWS S3
# 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