I first got carrierwave working by following the directions from this railscast:
http://railscasts.com/episodes/253-carrierwave-file-uploads
Then I hooked up s3 by following the directions here:
http://railgaadi.wordpress.com/2012/06/03/saving-files-in-amazon-s3-using-carrierwave-and-fog-gem/
My image_uploader.rb file:
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
storage :fog
def store_dir
"development/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :iphone do
process :resize_to_limit => [320, 160]
end
end
And my fog.rb file:
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => 'xxx', # required
:aws_secret_access_key => 'xxx', # required
}
config.fog_directory = 'goodlife.carrierwave' # required
end
This is the error I'm getting:
hostname "goodlife.carrierwave.s3-us-west-1.amazonaws.com" does not match the server certificate
Any advice? Thanks!
Adding :path_style => true to config.fog_credentials worked for me. I learned it from an answer to Amazon S3 - hostname does not match the server certificate (OpenSSL::SSL::SSLError) + rails .
Is goodlife.carrierwave the name of your bucket?
Edit:
Remove the period from your bucket name. That should fix it.
From Amazon:
If you want to access a bucket by using a virtual hosted-style request, for example, http://mybucket.s3.amazonaws.com over SSL, the bucket name cannot include a period (.).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.