Created
May 14, 2018 17:36
-
-
Save TonsOfFun/a0c54ba08cb81eb7a07543dd6b41d82d to your computer and use it in GitHub Desktop.
Crypto Smart Camera: Pre-signed POST to S3
This file contains hidden or 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 RequestSigning | |
| extend ActiveSupport::Concern | |
| included do | |
| before_action :set_s3_direct_post, only: [:new] | |
| end | |
| def set_s3_direct_post | |
| @s3_direct_post = AWS_S3_BUCKET.presigned_post(key: "uploads/#{SecureRandom.uuid}/${filename}", success_action_status: '201', acl: 'public-read') | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This concern provides a callback which can be used in a controller to populate a form for direct S3 file uploads