[英]CarrierWave fog, making s3 uploads public
I am using CarrierWave with Fog for my Rails app to uploads my image to AWS S3 bucket. 我将CarrierWave和Fog用于我的Rails应用程序,以将我的图像上传到AWS S3存储桶。 My config as follow:
我的配置如下:
CarrierWave.configure do |config|
config.fog_provider = 'fog/aws' # required
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => 'KEY',
:aws_secret_access_key => 'SECRET',
:region => 'us-west-2'
}
config.fog_directory = 'bucket101'
config.fog_public = true
config.fog_attributes = { 'Cache-Control' => "max-age=#{365.day.to_i}"}
end
The upload is success, but I can't view the uploaded image on the browser. 上载成功,但是我无法在浏览器中查看上载的图像。 This is what I get.
这就是我得到的。
Thanks!! 谢谢!!
Do you see the file uploaded in the S3 Console? 您在S3控制台中看到上传的文件了吗? What are the permissions?
有哪些权限?
config.fog_public = true
should have enabled public read. config.fog_public = true
应该已启用公共读取。 Note: that config has to be set (and the initializer re-run) before you do your upload in order to have an effect. 注意:必须先设置配置(并重新运行初始化程序),才能生效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.