Uploading large files on Heroku with Carrierwave

2019-03-21 16:37发布

问题:

I'm about to embark on a hobby project where I'll upload lots of files to S3. Some of the files will be large 50-100MB. I would like to use Heroku but can fallback on EC2 instead if needed.

Will Heroku + Carrierwave + S3 work for this? Or are there limitations to file uploads? If so what's a good alternative?

Also curious if there are any cool uploading libraries like uploadify but w/o the flash.

Thanks!

回答1:

I recommend taking advantage of S3's direct-upload feature. This will allow your users to upload straight to your S3 account (in a secure fashion), bypassing the upload to Heroku at all. This keeps your Dynos free to handle normal requests and avoids the high file-upload processing CPU costs as well as memory limit problems.

http://aws.amazon.com/articles/1434

This gem appears to just what you're looking for: https://github.com/dwilkie/carrierwave_direct