ruby s3_direct_uploading.rb

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby s3_direct_uploading.rb相关的知识,希望对你有一定的参考价值。

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

以上是关于ruby s3_direct_uploading.rb的主要内容,如果未能解决你的问题,请参考以下文章

Rails:s3_direct_upload - 如何保存/使用数据响应?

Rails 6,无法将 s3_direct_upload gem 上传到 UPLOAD,查看工作正常

ruby [Ruby Cheat] Cheatsheet #ruby

Ruby运算符

Ruby 25 岁了!Ruby 之父说 Ruby 3 有望 3 倍提速

如何学习ruby?Ruby学习技巧分享