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.

BurnHavoc BurnHavoc Been around fixing other peoples code for 20 years. 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) rayush33 rayush33 JavaScript (React.js, React Native, Node.js) Developer with demonstrated industry experience of 4+ years, actively looking for opportunities to hone my skills as well as help small-scale business owners with solutions to technical problems Stanislav Prigodich Stanislav Prigodich 15+ years building iOS and web apps at startups and enterprise companies. I want to use that experience to help builders ship real products - when something breaks, I'm here to fix it. 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. 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 Jaime Orts-Caroff Jaime Orts-Caroff I'm a Senior Android developer, open to work in various fields PawelPloszaj PawelPloszaj I'm fronted developer with 10+ years of experience with big projects. I have small backend background too Bastien Labelle Bastien Labelle Full stack dev w/ 20+ years of experience Yovel Cohen Yovel Cohen I got a lot of experience in building Long-horizon AI Agents in production, Backend apps that scale to millions of users and frontend knowledge as well.

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