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