I have an app in Heroku, I need simple file storage for uploaded images for this I used send_data using attachment_fu plugin. After that I have used the tmp/ directory to write this file and want to display on browser, But these files are not displayed in browser. How can I display these images on browser?
What is the alternate solution to store and retrieve images?
Thanks!
How Does Simple File Upload Work? Simple File Upload replaces a hidden input tag that you create with an upload widget. When your user adds a file, it is uploaded to the cloud and a URL that links to that file is returned. Simple File Upload is specifically designed to work with Heroku's ephemeral filesystem.
Images are seamlessly delivered through a fast CDN, and much much more. Cloudinary offers comprehensive APIs and administration capabilities and is easy to integrate with any web application, existing or new. Cloudinary provides URL and HTTP based APIs that can be easily integrated with any Web development framework.
Heroku has an “ephemeral” hard drive, this means that you can write files to disk, but those files will not persist after the application is restarted. By default Active Storage uses a :local storage option, which uses the local file system to store any uploaded files.
You cannot store uploaded files on Heroku.
You must use an alternative strategy. A couple alternative strategies:
Store uploaded files in your database on Heroku. Because database systems are not specifically optimized for storing files, you should test out how well your application performs under load before you use this strategy.
Store uploaded files in an external storage service. Amazon S3 is a popular cloud storage service that anyone can use, and it has pay-as-you-go pricing just like Heroku. (In fact, Heroku itself runs on top of another of Amazon's cloud services, EC2.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With