Prompt
my app keeps losing uploaded files after redeploying
Latest observation
Oct 12, 2026
OpenAI APIWeb search: off
That usually means your uploaded files are being stored somewhere ephemeral inside the app container or VM, and redeploying replaces that storage.
Common causes
-
Files saved inside the app’s local filesystem
- Example: uploading to
./uploads,/tmp,/var/www/uploads, etc. - On redeploy, container rebuild, restart, or new instance creation, those files may disappear.
- Example: uploading to
-
Running in containers without a persistent volume
- Docker/Kubernetes/Heroku/Render/Fly/etc. often give you ephemeral disk unless you explicitly mount persistent storage.
-
Multiple instances/load balancing
- Upload goes to one instance, but after redeploy or scaling, requests hit another instance that doesn’t have the file.
-
Build/deploy process overwrites the directory
- If your uploads directory is inside the project folder that gets replaced during deployment, uploaded files get wiped.
Best practice
Store uploaded files in persistent external storage, such as:
- Amazon S3
- Google Cloud Storage
- Azure Blob Storage
- Cloudinary (for images/media)
- A mounted persistent disk/volume
- A dedicated file server/NAS
Then store only the file URL/path in your database.
If you want to keep local storage
Make sure uploads go to a path that is:
- outside the deployed code directory, and
- mounted as a persistent volume/disk.
Examples
- Docker: mount a volume like
/data/uploads - Kubernetes: use a
PersistentVolumeClaim - Render/Fly/Heroku: use their persistent disk options, or switch to object storage
- AWS EC2: use EBS or another mounted persistent disk
Quick check
Look at your upload code and ask:
- Is it saving to a folder inside the app repo?
- Is that folder included in the deployment artifact?
- Is there any persistent volume mounted there?
If you want, paste:
- your deployment platform,
- your upload code,
- and where files are being saved,
and I can tell you exactly what’s causing it and how to fix it.