shadcn's form with uploadthing sdk
I am trying to upload an image to UploadThing through the SDK inside a server action. But I'm not sure how to fulfill the
uploadFiles
parameters because I'm not receiving a FormData from the form.
My idea was to parse the image to base64 before sending to the server and then uploading it (that's what I usually do in my local projects) but I actually don't know how to pass base64 to be uploaded.5 Replies
Were you able to fix this?
Do you have your schema with image as type of file and are you using controlled components provided by react hook form to get the file data and pass it to shadcn form data
I didn't find a way to fix this, so I drop the support for passing files and I'm using URLs for now.
I have some workaround I think
https://github.com/alex289/what-do-we-eat/blob/main/src/components/upsert-food.tsx
GitHub
what-do-we-eat/src/components/upsert-food.tsx at main · alex289/wha...
Web app to tell you what to eat. Contribute to alex289/what-do-we-eat development by creating an account on GitHub.
It’s not using server actions but maybe it could be converted easily