forge42dev / remix-hook-form

Open source wrapper for react-hook-form aimed at Remix.run
MIT License
332 stars 27 forks source link

Can't post files / upload files in remix-hook-form #36

Closed Centerworx closed 11 months ago

Centerworx commented 11 months ago

In the below code, you are stringifying the whole form and Files can not be stringified they do not get sent to the server.

export const createFormData = <T extends FieldValues>( data: T, key = "formData" ): FormData => { const formData = new FormData(); const finalData = JSON.stringify(data); formData.append(key, finalData); return formData; };

I'm working on the PR to fix this, and will submit it once I'm finished. I just wanted to document the issue first.