Next.js Discord

Discord Forum

How do I handle file uploads

Unanswered
Tan posted this in #help-forum
Open in Discord
TanOP
I have a form to createPizza which takes fields (title price desc image). I want to upload the image to supabase storage and then modify the formdata to have the uploaded image url as the value for image. How can I achieve this ? I am using server action with the useFormState hook and zod in the server action for validation.

2 Replies

one way is through React State. If you put your server action inside the functional component, then you update your state directly