最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to Serve Dynamic Images in Next.js Without Rebuild Process the Project? - Stack Overflow

programmeradmin2浏览0评论

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.).
发布评论

评论列表(0)

  1. 暂无评论