Theo's Typesafe CultTTC
Theo's Typesafe Cult11mo ago
4 replies
Kazz

UploadThing file accept type restriction

I'm trying to find how I can allow the <UploadButton /> to only accept images for example with extensions of (.png, .jpg ...etc).

Because currently my users are able to upload .gif for example and I don't want to allow that.

I searched the docs but there is nothing regarding image type restriction or acceptation. Unless I missed something...
Solution
Thanks that solves it for me.

However if I used this I wont be able to set maxFileSize and maxFileCount

profilePicture: f(['image/jpeg', 'image/png', 'image/avif', 'image/webp'])

// I wont be able to set these things now
imageUploader: f({ image: { maxFileSize: '1MB', maxFileCount: 1 } })
Was this page helpful?
UploadThing file accept type restriction - Theo's Typesafe Cult