Heroku application file upload - file is deleted after some time?
Heroku file system is ephemeral so files are temporary and removed at every Dyno restart. It is likely that you have redeployed your application causing the restart of the Dyno.
Heroku also restarts a Dyno at least every 24 hours. See Heroku documentation
The good practise is to persist the files into an external storage (S3 for example). If you are interested in finding out which free options are available you can check this Git repo HerokuFiles
Error user uploading file on Heroku but not local
Turns out that uploading pics <2MB worked. Maybe it's a setting in php.ini but not sure how to edit that on Heroku
Error while uploading image on Heroku Node.js app
These errors are typically caused by the target directory (in your case, /app/public/productimages/
) not yet existing.
You can use a package like mkdirp
to create the directory when your app starts, or you could create the directory locally and create an empty placeholder file (named .placeholder
, for instance) that you commit to your Git repository (because Git only deals with files, not directories, you can't add a completely empty directory to a repository).
Related Topics
Can't Get Rack-Cors Working in Rails Application
How to Run Rails Console in the Test Environment and Load Test_Helper.Rb
Ruby - Replace the First Occurrence of a Substring with Another String
Rails Search with Optional Parameters
How Does Defining [Square Bracket] Method in Ruby Work
Hashes of Hashes Idiom in Ruby
Ruby on Rails: Devise, Want to Add Invite Code
Rspec: How to Test If a Method Was Called
Cannot Execute "Rails Console" Due to an Error with Readline
How to Handle Errors with Httparty
How to Use Dot Syntax for Ruby Hash
Silencing Deprecation Warnings in Rails 3
Gem Install Pg Can Not Bind to Libpq
Importing CSV Quoting Error Is Driving Me Nuts