My app is hosted on Heroku and I am wondering if its possible to upload a file not to the public/ folder on Heroku but directly to - say - Linode
My app uses both Heroku and Linode. The two talk to each other via web-service requests. But generally speaking, I try to store any generated/uploaded file on Linode only - and nothing on Heroku
Now I have a situation where I want to allow users to upload files. The final destination would be Linode. But currently, I am having to go from Client PC -> Heroku -> Linode. The optimal solution would, however, be Client PC -> Linode
I thought I would ask before I attempt to re-wire existing code. Would changing storage_dir method as follows do the trick?
def storage_dir
return http://<linode>/<local-folder>
end
Thanks for your help Abhinav
So, you're using CarrierWave? I'm not sure how you're currently uploading to Linode, but I'll take a stab.
So, according to CarrierWave's documentation on GitHub, you need to add something like this to perhaps a carrierwave.rb file in your config/initializers:
Of course, that's if you're using Amazon AWS S3. I found some fog documentation for linode (& other storage services) at http://ruby-doc.org/gems/docs/p/phpfog-fog-0.4.1.2/Fog/Linode/Compute/Mock.html If you click on 'new(options={}),' you will see
@linode_api_key = options[:linode_api_key]
. So, I think you'll be able to use CarrierWave to upload directly to Linode with: