Replit storage

File Uploads Disappearing on Replit

Users upload files through your app — profile pictures, documents, images — and everything appears to work. But after some time, a restart, or a redeployment, all uploaded files are gone. Users see broken image icons and download links that return 404 errors.

The root cause is that your app saves uploaded files to the container's local filesystem, which is ephemeral on Replit. The AI-generated file upload code typically uses multer, formidable, or similar libraries configured to write files to a local /uploads directory.

Even if your app is on Replit's development mode and files seem to persist for a while, they will eventually be lost when the container cycles or you deploy changes.

Error Messages You Might See

ENOENT: no such file or directory, open '/home/runner/uploads/photo.jpg' 404 Not Found: /uploads/document.pdf Error: Cannot find uploaded file Broken image icon in browser
ENOENT: no such file or directory, open '/home/runner/uploads/photo.jpg'404 Not Found: /uploads/document.pdfError: Cannot find uploaded fileBroken image icon in browser

Common Causes

  • Local disk storage — uploads saved to /uploads or /public/uploads on the ephemeral filesystem
  • Multer default config — file upload middleware configured with diskStorage pointing to local directory
  • No CDN or cloud storage — the app was not set up with an external file hosting service
  • Broken file URLs — files are referenced by local paths that become invalid after restart
  • Large files filling disk — uploads consume limited container disk space and trigger cleanup

How to Fix It

  1. Integrate cloud storage — use AWS S3, Cloudinary, or Supabase Storage to store uploads permanently
  2. Switch upload middleware — replace multer diskStorage with multer-s3 or a Cloudinary upload stream
  3. Store URLs in database — save the cloud storage URL in your database instead of a local file path
  4. Add file size limits — configure maximum upload sizes to prevent disk exhaustion
  5. Serve files from CDN — use the cloud storage URL directly in your HTML instead of serving from your app
  6. Migrate existing files — write a one-time script to upload existing local files to cloud storage and update database references

Real developers can help you.

Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) Simon A. Simon A. I'm a backend developer building APIs, emulators, and interactive game systems. Professionally, I've developed Java/Spring reporting solutions, managed relational and NoSQL databases, and implemented CI/CD workflows. Antriksh Narang Antriksh Narang 5 years+ Experienced Dev (Specially in Web Development), can help in python, javascript, react, next.js and full stack web dev technologies. PawelPloszaj PawelPloszaj I'm fronted developer with 10+ years of experience with big projects. I have small backend background too Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services David Olverson David Olverson Solo dev shipping production apps with AI-assisted development. I specialize in rescuing broken Lovable/Bolt/Cursor builds and taking them to production. 10+ apps shipped including SaaS CRMs, gaming platforms, real estate tools, and Discord bots. Stack: Next.js 16, TypeScript, Tailwind CSS, FastAPI, PostgreSQL, Prisma. I use Claude Code with 50+ custom skills for rapid delivery. Average turnaround: 2-4 weeks from broken prototype to production. Victor Denisov Victor Denisov Developer Dor Yaloz Dor Yaloz SW engineer with 6+ years of experience, I worked with React/Node/Python did projects with React+Capacitor.js for ios Supabase expert Kingsley Omage Kingsley Omage Fullstack software engineer passionate about AI Agents, blockchain, LLMs. Basel Issmail Basel Issmail ’m a Senior Full-Stack Developer and Tech Lead with experience designing and building scalable web platforms. I work across the full development lifecycle, from translating business requirements into technical architecture to delivering reliable production systems. My work focuses on modern web technologies, including TypeScript, Angular, Node.js, and cloud-based architectures. I enjoy solving complex technical problems and helping teams turn product ideas and prototypes into working platforms that can grow and scale. In addition to development, I often collaborate closely with product managers, business analysts, designers, and QA teams to ensure that solutions align with both technical and business goals. I enjoy working with startups and product teams where I can contribute both as a hands-on engineer and as a technical partner in designing and delivering impactful software.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

Why do uploaded files disappear on Replit?

Replit containers are ephemeral — the filesystem is rebuilt on each deployment. Files saved to disk at runtime are not part of your source code and get deleted.

What is the easiest cloud storage to set up?

Cloudinary is the easiest for images — it has a free tier and a simple upload API. For general files, Supabase Storage is straightforward and also has a free tier.

Can I store small images in the database instead?

Yes, for small files like avatars (under 1MB), you can store them as base64-encoded strings in your database. This is not recommended for larger files.

Related Replit Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help