Example of client-side file upload in Next.js
React
TypeScript
NextJS
Create .env
file and set variable
# host
NEXT_PUBLIC_API="https://seer-of-human.com"
NEXT_PUBLIC_HOST_NAME="seer-of-human.com"
NEXT_PUBLIC_PROTOCOL="https"
# local
# NEXT_PUBLIC_API="http://localhost:3000"
# NEXT_PUBLIC_HOST_NAME="localhost"
# NEXT_PUBLIC_PROTOCOL="http"
npm install
npm run dev
npm run build
npm start
Deploy on Vercel
Live Demo: nextjs-upload-file
API Repo: https://github.com/kanokpit-yowaratch/nestjs-upload-api API Demo: https://seer-of-human.com