简体   繁体   中英

Uploading to multiple buckets using paperclip

Hey all I can't seem to find anything out there on the net except an old article that leads to a no longer existing page but I was wondering if paperclip supports uploading to multiple buckets on S3 at the same time.

I keep the same images in three locations(don't ask) and I am hoping to have them all upload using my current system when the files are dropped in. See an example of what I am looking to do below. These buckets all have the same credential I just need them in three spots.

storage: :s3,
s3_credentials: Proc.new{|a| a.instance.s3_credentials }

def s3_credentials
  {bucket: "foo/bar", access_key_id: ENV["access_key_id"], secret_access_key: ENV["secret_access_key"]}
end

I tried procing a new s3_credentials and adding a second credential call with no luck.

Thanks for your time!

I think you'd better declare the bucket name separately from access_key_id and secret_access_key.

Try with the following instruction:

http://codetunes.com/2008/uploading-to-multiple-s3-buckets-with-paperclip-and-rails/

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM