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.

Jen Jacobsen Jen Jacobsen I’m a Full-Stack Developer with over 10 years of experience building modern web and mobile applications. I enjoy working across the full product lifecycle — turning ideas into real, well-built products that are intuitive for users and scalable for businesses. I particularly enjoy building mobile apps, modern web platforms, and solving complex technical problems in a way that keeps systems clean, reliable, and easy to maintain. Rudra Bhikadiya Rudra Bhikadiya I build and fix web apps across Next.js, Node.js, and DBs. Comfortable jumping into messy code, broken APIs, and mysterious bugs. If your project works in theory but not in reality, I help close that gap. 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. 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 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. 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.** BurnHavoc BurnHavoc Been around fixing other peoples code for 20 years. Prakash Prajapati Prakash Prajapati I’m a Senior Python Developer specializing in building secure, scalable, and highly available systems. I work primarily with Python, Django, FastAPI, Docker, PostgreSQL, and modern AI tooling such as PydanticAI, focusing on clean architecture, strong design principles, and reliable DevOps practices. I enjoy solving complex engineering problems and designing systems that are maintainable, resilient, and built to scale. Anthony Akpan Anthony Akpan Developer with 8 years of experience building softwares fro startups Jaime Orts-Caroff Jaime Orts-Caroff I'm a Senior Android developer, currently working at Aircall. I'm open to work in various fields!

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