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.

Jared Hasson Jared Hasson Full time lead founding dev at a cyber security saas startup, with 10 yoe and a bachelor's in CS. Building & debugging software products is what I've spent my time on for forever Anthony Akpan Anthony Akpan Developer with 8 years of experience building softwares fro startups 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. Daniel Vázquez Daniel Vázquez Software Engineer with over 10 years of experience on Startups, Government, big tech industry & consulting. Omar Faruk Omar Faruk As a Product Engineer at Klasio, I contributed to end-to-end product development, focusing on scalability, performance, and user experience. My work spanned building and refining core features, developing dynamic website templates, integrating secure and reliable payment gateways, and optimizing the overall system architecture. I played a key role in creating a scalable and maintainable platform to support educators and learners globally. I'm enthusiastic about embracing new challenges and making meaningful contributions. Nam Tran Nam Tran 10 years as fullstack developer hanson1014 hanson1014 Full-stack developer experienced in fixing and deploying AI-generated apps from Lovable, Bolt.new, Cursor, and Replit. I specialize in debugging Supabase integration issues (auth flows, RLS policies, database connections), fixing broken deployments, resolving routing/blank screen problems, and cleaning up messy React/Vite codebases. I also build production apps with the Claude API and have shipped a Mac desktop dev tool (Nexterm from scratch. Based in Hong Kong, fast turnaround. Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure AUXLE AUXLE I am a Full Stack Developer experienced in building Websites, Web apps and Cross Platform Mobile Apps for Startups and Companies. Sage Fulcher Sage Fulcher Hey I'm Sage! Im a Boston area software engineer who grew up in South Florida. Ive worked at a ton of cool places like a telehealth kidney care startup that took part in a billion dollar merger (Cricket health/Interwell health), a boutique design agency where I got to work on a ton of exciting startups including a photography education app, a collegiate Esports league and more (Philosophie), a data analytics as a service startup in Cambridge (MA) as well as at Phillips and MIT Lincoln Lab where I designed and developed novel network security visualizations and analytics. I've been writing code and furiously devoted to using computers to make people’s lives easier for about 17 years. My degree is in making computers make pretty lights and sounds. Outside of work I love hip hop, the Celtics, professional wrestling, magic the gathering, photography, drumming, and guitars (both making and playing them)

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