Uploadthing multiple upload files

I have 1 feature, where users can upload as many files as they want, how can I upload as many files as possible, without having any limits? If I omit maxFileCount, I can only upload 1 file, is there a way? If there is no way, maybe the solution is to make maxFileCount be 99999 or more
export const ourFileRouter = {
imageUploader: f({ image: { maxFileSize: "4MB", maxFileCount: 10 } })
.input(z.object({ productId: z.string().uuid() }))
.middleware(async ({ input }) => ({ input }))
.onUploadComplete(async ({ metadata: { input: { productId } }, file }) => {
console.info(file.url)
await db.image.create({ data: { productId, url: file.url } });

return { success: true };
}),
} satisfies FileRouter;
export const ourFileRouter = {
imageUploader: f({ image: { maxFileSize: "4MB", maxFileCount: 10 } })
.input(z.object({ productId: z.string().uuid() }))
.middleware(async ({ input }) => ({ input }))
.onUploadComplete(async ({ metadata: { input: { productId } }, file }) => {
console.info(file.url)
await db.image.create({ data: { productId, url: file.url } });

return { success: true };
}),
} satisfies FileRouter;
I've tried reading the documentation, but I can't find it at all, or am I looking at it wrong or something, whatever it is, please help me out.
2 Replies
Sturlen
Sturlen6mo ago
this is just a guess, but setting maxFileCount to Infinity might work. though I'd imagine 99999 would be more than enough
wei
weiOP6mo ago
Oke thankyou sir
Want results from more Discord servers?
Add your server