Created
March 10, 2017 23:28
-
-
Save eprothro/f615b1b35186ce958b5dc7f5635283d1 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
module S3DirectUploading | |
extend ActiveSupport::Concern | |
included do | |
S3_UPLOAD_BUCKET = Aws::S3::Resource.new.bucket(ENV['S3_UPLOAD_BUCKET']) | |
helper_method :build_s3_direct_post | |
end | |
protected | |
def build_s3_direct_post | |
S3_UPLOAD_BUCKET.presigned_post(key: "web_uploads/#{SecureRandom.uuid}/${filename}", | |
success_action_status: '201', | |
acl: 'public-read', | |
content_type_starts_with: "") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment