rvf icon indicating copy to clipboard operation
rvf copied to clipboard

[Bug]: File type doesn't work in validation for next-safe-action (Next Server Actions)

Open foopis23 opened this issue 7 months ago • 1 comments

Which packages are impacted?

  • [ ] @rvf/react
  • [ ] @rvf/react-router
  • [ ] @rvf/zod
  • [ ] @rvf/yup
  • [x] zod-form-data

What version of these packages are you using?

  • "zod-form-data": "^2.0.7",
  • "next-safe-action": "^7.10.6",
  • "next": "15.2.3",

Please provide a link to a minimal reproduction of the issue.

https://github.com/foopis23/zfd-server-action-file-validation

Steps to Reproduce the Bug or Issue

  1. Run Application
  2. Go to http://localhost:3000
  3. Select files to upload
  4. Hit submit button
  5. See validation errors

Expected behavior

I expected validation to pass when files were uploaded. They are coming in as an array of file instances so i don't know why its failing.

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Arc
  • Version: 135.0.7049.116 (Official Build) (arm64)

Additional context

The two important files are: src/app/page.tsx src/server-actions/submit.ts

I implemented a non working (using zfd) and working version of the server action. For the working version i just made a custom zod type that worked the way i expected zfd.file() to work.

foopis23 avatar May 21 '25 17:05 foopis23

Hi!

I cloned the repo, but everything appears to work fine as far as I can tell. What version of node are you using?

airjp73 avatar Aug 28 '25 17:08 airjp73