views:

525

answers:

4

I'm using paperclip for uploading images in S3. But I've noted that this upload is very slow. I think because before complete the submit the file has to pass by my server, be processed and be sent to the S3 server.

Is there a method for accelerate this?

thanks

A: 

Do you want to improve the appearance of the upload being faster or actually make the upload faster?

If it's the former you can put your image handling logic into a background task using something like delayed_job. This way when a user clicks the button they'll immediately go to their next page while you process the image (you can show a "processing in progress" image placeholder until the task is finished).

If it's the latter then it's entirely down to your server and internet connection. Where are you hosting?

jonnii
A: 

How about uploading direct to S3?

Not sure if paperclip does this out of the box, but you could make it.

http://docs.amazonwebservices.com/AmazonS3/2006-03-01/dev/index.html?UsingHTTPPOST.html

cwninja
A: 

As cwninja recommends, we upload direct to s3 so as to get rid of this extra upload. We use a modified version of the plugin described in this blog post:

http://www.elctech.com/articles/updates-on-rails-s3-flash-upload-plugin

Ours is modified to handle multiple file uploads (rewrote the the flex object

Not sure how well this plays with paperclip, we use attachment_fu, but it wasn't so bad to get it to work with that.

Andrew Kuklewicz
the link is broken
Tony
new link is here: http://web.elctech.com/2009/02/26/updates-on-rails-s3-flash-upload-plugin/
John
A: 

Use delayed jobs, this is a good example here
Or you can use flash upload.

Devenv