I simply would like to repeat this guide: https://medium.com/@_hanglucas/file-upload-in-next-js-app-router-13-4-6d24f2e3d00f for uploading files using Next.js, but the line const formData = await req.formData();
throws error, it says Error [TypeError]: req.formData is not a function
, although autocomplete of Visual Studio Code displays, that such method exists (method) Body.formData(): Promise<FormData>
and there is no error.
Since this is the TypeError
, I updated next, react, typescript
and @types
related to it to @latest
, but still have this error.
Any ideas why is it so? Maybe there is another @types
I must install?
Versions:
“next”: “^13.4.4”,
“react”: “^18.2.0”,
“react-dom”: “^18.2.0”,
“typescript”: “^5.1.3”,
“@types/node”: “^20.2.5”,
“@types/react”: “^18.2.8”,
“@types/react-dom”: “^18.2.4”