S3直接上传不上传文件

/config/intilializers/paperclip.rb

Paperclip::Attachment.default_options[:storage] = :s3 Paperclip::Attachment.default_options[:bucket] = 'xxx' Paperclip::Attachment.default_options[:s3_permissions] = :public_read Paperclip::Attachment.default_options[:s3_credentials] = { access_key_id: 'xxx' ,secret_access_key: 'xxx'} 

/config/intilializers/s3_direct_upload.rb

 S3DirectUpload.config do |c| c.access_key_id = 'xx' # your access key id c.secret_access_key = 'xxx' c.bucket = 'xxx' # your bucket name c.region = 's3-ap-southeast-1' end AWS.config({ :access_key_id => 'xxx', :secret_access_key => 'xxx', :region => 'ap-southeast-1' }) 

Ad.rb

 has_attached_file :thumbnail, styles: { thumb: "50x50>" } validates_attachment_size :thumbnail, :less_than => 100.megabytes # validates_attachment_presence :thumbnail validates_attachment_content_type :thumbnail, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif"] 

_form.html.erb

 
{%=o.name%}

当我提交它时,不会在S3上传任何内容。 我错过了什么?