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.

ISHANTDEEP SINGH ISHANTDEEP SINGH Senior Software Engineer with 7+ years of experience in React, JavaScript, TypeScript, Next.js, and Node.js. I’ve also worked as a tech lead for startups, owning end-to-end technical execution including architecture, development, scaling, and delivery. I bring a strong mix of hands-on coding, product thinking, and technical leadership, and I’m comfortable building products from scratch as well as improving and scaling existing systems. Taufan Taufan I’m a product-focused engineer and tech leader who builds scalable systems and turns ideas into production-ready platforms. Over the past years, I’ve worked across startups and fast-moving teams, leading backend architecture, improving system reliability, and shipping products used by thousands of users. My strength is not just writing code — but connecting product vision, technical execution, and business impact. Matthew Jordan Matthew Jordan I've been working at a large software company named Kainos for 2 years, and mainly specialise in Platform Engineering. I regularly enjoy working on software products outside of work, and I'm a huge fan of game development using Unity. I personally enjoy Python & C# in my spare time, but I also specialise in multiple different platform-related technologies from my day job. Luca Liberati Luca Liberati I work on monoliths and microservices, backends and frontends, manage K8s clusters and love to design apps architecture 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. Tejas Chokhawala Tejas Chokhawala Full-stack engineer with 5 years experience building production web apps using React, Next.js and TypeScript. Focused on performance, clean architecture and shipping fast. Experienced with Supabase/Postgres backends, Stripe billing, and building AI-assisted developer tools. Mehdi Ben Haddou Mehdi Ben Haddou - Founder of Chessigma (1M+ users) & many small projects - ex Founding Engineer @Uplane (YC F25) - ex Software Engineer @Amazon and @Booking.com 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. Jaime Orts-Caroff Jaime Orts-Caroff I'm a Senior Android developer, open to work in various fields Caio Rodrigues Caio Rodrigues I'm a full-stack developer focused on building practical and scalable web applications. My main experience is with **React, TypeScript, and modern frontend architectures**, where I prioritize clean code, component reusability, and maintainable project structures. I have strong experience working with **dynamic forms, state management (Redux / React Hook Form), and complex data-driven interfaces**. I enjoy solving real-world problems by turning ideas into reliable software that companies can actually use in their daily operations. Beyond coding, I care about **software quality and architecture**, following best practices for componentization, code organization, and performance optimization. I'm also comfortable working across the stack when needed, integrating APIs, handling business logic, and helping transform prototypes into production-ready systems. My goal is always to deliver solutions that are **simple, efficient, and genuinely useful for the people using 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