views:

253

answers:

1

I have a rails app with Video and Image models. Both use SWFUpload for progress indication feedback and queued uploading. So they are uploaded to a TempImage, and TempVideo model then when the ActiveRecord Video and Image models are saved the temps are moved over.

On the images the different styles are created with the default paperclip processor. On the videos after they are uploaded they are queued in the background (using starling & workling) to be transcoded to FLV format and have a jpg thumbnail created.

So my question is this: I want to be able to do all these conversions on the local server, but I'd like the files to be stored on S3 in the end to preserve space and bandwidth on my server. How can I use the S3 backend for paperclip to do this? Or instead should I have a background task that does the upload to S3 independently of paperclip after all the after_save tasks are done which updates the paperclip attributes to reflect the new S3 path?

+2  A: 

I just wrote an article explaining how I handle syncing of a Paperclip upload(to the filesystem) and Amazon S3 in the background with Starling and Workling. You might be able to adapt this to your situation.

http://aaronvb.com/blog/2009/7/19/paperclip-amazon-s3-background-upload-using-starling-and-workling

Aaron Van Bokhoven