使用回形针将照片上传到Amazon s3时出现问题

时间:2011-07-22 17:52:35

标签: ruby-on-rails ruby ruby-on-rails-3 amazon-s3 paperclip

我的模特:

  has_attached_file :avatar, :styles => { :thumb => "65x65>" },
  :storage => :s3,
  :s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
  :bucket => "doweet-image", 
  :path => ":attachment/:id/:style.:extension"

当我将图像上传到亚马逊s3并将其放在视图上时:

<%= image_tag(current_user.avatar.url(:small))%>

照片没有显示,当我复制链接src照片时,这是:

http://s3.amazonaws.com/doweet-image/avatars/1/small.jpg?1311356386

当我去链接时,我遇到了这个错误:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>152EBFC9033E6633</RequestId>
<HostId>
Iw3zWXuCC6JjPAJig+pBVqQbLilN4dmTY4VooVO5CVKCH3O/MN3VDawXbI6Zd5NP
</HostId>
</Error>

1 个答案:

答案 0 :(得分:2)

进入您的s3存储桶并确保您的文件夹具有对所有文件的读取权限。看起来它正在寻找图像,但没有读取权限。

如果您使用的是Mac,我建议传输,但我确信通过网络界面就足够了。