upload image using supabase
does anyone had a method to upload multiple image and save it to db using trpc endpoint?
(im using supabase) thanks in advance
7 Replies
and how to handle images but from front end side
Currently there is no option to upload multiple files at once so you'll have to make a loop
I wrote something like this a while ago
@Devastated
so the urls variable is array?, if so how i save it to db do i need to loop it again
do i put your code above at my trpc router or in tsx file?
sorry for the late reply, its night in my timezone😂
and how you upload it from frontend if you handle multiple images
Idk because I am not using trpc, the code above runs on my fastify backend and the urls is an array of objects
{ img: 'http...
}
In the above example I had a separate table in db so I just used
prisma.offerImage.createMany and put the
urls as a
data`So createmany accept array of object?
Why don't you check prisma docs @Devastated ? 🙂
ahh ok thankss