Next.js Discord

Discord Forum

Newly uploaded images not loading in production.

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
I've implemented functionality that allow users to save images on my website. The images are saved in the public folder. This is the error I get when I attempt to load the image after it has been uploaded.
" https://rentaldb.org/uploads/clients/99b5d3d2-0dcf-4c17-936f-6b932e063dd6/Permit.jpg 404 (Not Found)"

If I restart the server, the image gets loaded like normal.

5 Replies

you have to use a storage bucket for this
something like cloudflare R2, S3 or similar
https://www.reddit.com/r/nextjs/comments/13e1r3y/how_to_upload_a_file_to_the_public_folder_using/
@Sun bear You can't use public folder as data bucket. Try other providers like s3 or https://cloudinary.com/