heroku has a read-only file system, so it's not that easy to work with file uploads. One way to go about it is by using MongoDB with it's GridFS, which stores files right in the database.
There are a bunch of beautiful gems out there for this, the most famous and IMO polished one being Carrierwave. There is one thing that needs to be done for this to work, though, and it's kind of pain to figure out what's wrong with heroku's limited error messages.
Because of heroku's being read-only, you need to change the working directory for Carrierwave to your Applications "/tmp" directory. For this, change your /config/initializers/carrierwave.rb like this:
1 CarrierWave.configure do |c| 2 c.grid_fs_connection = Mongoid.database 3 c.storage = :grid_fs 4 c.root = File.join( Rails.root, "tmp" ) 5 end
The important part here is the "c.root". This is easily overlooked, and can cause major headache when not taken care of.
And while we're talking about GridFS and MongoDB, I recommend you check out MongoLab, they offer a 240MB database plan for free, which is great for all your file uploading needs!
2011.05.17