Closed KhoeLe closed 2 weeks ago
Not related to next-safe-action, got the same error with your schema and without using this library. You need to pass the file in FormData
, I suggest using zod-form-data on top of Zod to validate the form.
Hello @TheEdoRan
I am having issues using react-hook-form with a Zod schema for file uploads (z.instanceof(File)). I am encountering errors. Do you have any ideas for resolving this?
Hello @TheEdoRan
I am having issues using react-hook-form with a Zod schema for file uploads (z.instanceof(File)). I am encountering errors. Do you have any ideas for resolving this?
File isn't a type noticed by nextjs if your node version is below >= 20.0. The potential alternative may be to try z.instanceof(Blob))
, I haven't tried it out myself though
I'm having the same problem, is there a workaround?
Are you using the latest version of this library?
Is there an existing issue for this?
Describe the bug
I am experiencing issues when creating a form that includes a file upload using useAction. Below is the code where the problem occurs:
Reproduction steps
form-action.tsx
logic code handle submit
form input upload file
Expected behavior
Problem occurs during the form submission process.
Reproduction example
https://github.com/KhoeLe/next-safe-action.git
Operating System
Windows 10
Library version
"next-safe-action": "^6.2.0",
Additional context
if I remove the file from the formDataSchema and any related components, the form submits successfully
No response