TanStackT
TanStack6mo ago
1 reply
awake-maroon

Receiving a file in a server function

Initially, I tried to use zod-form-data to be the validator:

.validator((data: unknown) => schema.parse(data))


this would be rejected that the type of the file param is not File. I see the same issue when using FormData:

.validator((data) => {
if (input instanceof FormData) {
      const blob = input.get("blob");
      const id = input.get("id");
      const kind = input.get("kind");
      })

when i console.log(typeof blob), I get string.
Was this page helpful?