Next.js Discord

Discord Forum

image upload using NEXTJS App dir. Need help

Five-striped Sparrow posted this in #help-forum
Open in Discord
Five-striped SparrowOP
What is the best way to upload image to the client site folder using nextJS App dir. Need help

3 Replies

you can't upload to /public. the public content is taken at build so you need to rebuild (if you use vercel) or restart the server (if you self-host) to get the new files
so you have to use a separate file storage solution like aws s3 or cloudflare r2 (if you use vercel) or save it elsewhere and read it with fs (if you self-host)
Five-striped SparrowOP
I would like to upload image inside the project directory and show it and I'll just save the path to the database is it possible? any sample code or package