Heroku only has 100MB of file storage, right? I'm making a low-level rails app and I really like Heroku, but if my app allows each user to upload one picture, I may run out of space quickly...is there a simple solution that will allow me to have alternative file storage for profile pics or something of the like?
-
28While you do want to use S3 on Heroku (since the file space is only temporary, and does not persist) for storing things like profile pictures (see Codeglot's answer below), I do want to point out that the 100MB limit is only for the slug (the compiled source and gems of your application). Your /tmp directory can actually hold very large files (I think I've seen talk of 4GB being alright to store there temporarily). But, again, you will lose whatever is there if your dyno restarts, so it's only meant to be used as a temporary storage space, not a permanent one. – Riley Dutton Jul 11 '11 at 22:19
-
1in addition see the Heroku dev center article [here](http://devcenter.heroku.com/articles/s3) on the topic – John Beynon Jul 12 '11 at 10:59
3 Answers
I would recommend you to check heroku add-on solution which is https://addons.heroku.com/cloudinary. You will get 500MB for free and easy heroku integration.
For RoR app you can check: https://devcenter.heroku.com/articles/cloudinary#using-with-ruby-on-rails

- 19,102
- 6
- 69
- 67
-
1I found Cloudinary to be a perfect solution, it now provides 10 GB of free storage. Also, definitely check this django app: https://github.com/klis87/django-cloudinary-storage, it requires only changing some settings unlike the original Cloudinary app alone which requires changing code in models, views, and templates! – Karim Sonbol Aug 03 '18 at 13:42
See this blog post
In your model.
has_attached_file :picture,
:styles => {:large => "275x450>"},
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:path => "appname/:attachment/:style/:id.:extension"
In s3.yml in your config dir:
development:
bucket: bucketname
access_key_id: key
secret_access_key: key
production:
bucket: bucketname
access_key_id: key
secret_access_key: key
Then go signup for a bucket at Amazon S3: http://aws.amazon.com/s3/
Yes, the simplest solution is to use the api.imgur.com, which allows you to upload 1250 images for free per hour.
You just need to register and get your client id then you need to send post request to
https://api.imgur.com/3/upload
with the image data as form data. Then you get a link of the uploaded image in response data which you can store it in database and then you can access the image like any other image with the link from front end.
more here:

- 381
- 2
- 10