I am building a Next.js application where I upload images dynamically to a folder within the project. The images are being uploaded to a folder like public/uploads.
Issue:
- In Development: The images are uploaded successfully and can be accessed via URLs like http://localhost:3000/uploads/image.jpg.
- In Production: The newly uploaded images are not accessible unless I rebuild the project. The images are saved in public/uploads, but I can’t access them without rebuilding.
What I have Tried:
- I am uploading the images directly into the public/uploads folder using multer.
- I’m attempting to access the images directly via URLs like http://localhost:3000/uploads/image.jpg once they are uploaded.
What I Need:
- A solution to access newly uploaded images in production without requiring a rebuild of the Next.js application.
- I do not want to change the folder path (keeping everything under public/uploads).
- I do not want to use external storage (e.g., cloud storage services like AWS, Firebase, etc.).