I use my server to store user uploaded pictures. This is great however when I make a change to the code it reflects this and deletes my pictures stored on the server.
git push heroku master
How do I prevent this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Heroku’s filesystem is read-only so you can’t and shouldn’t store uploaded files in your dynos.
If you think about it, it makes sense. You can have multiple dynos running your app so you can’t guarantee which dyno is receiving the pictures.
Dynos should be stateless anyway, so you can easily scale your application up or down.
The preferred way to do file uploads on Heroku is to use Amazon S3 as outlined in their DevCenter.