Uploadthing limiting number of images uploaded

I know that we can limit it using maxFileCount but in my client components, I can keep uploading 8 files non stop and it wont be a problem. Is there a way that I can set that limit in UploadDropzone or other components so that I can limit the number of images user pick from their computer?

I was thinking of implementing something like this but I am not sure which error to throw without crashing my app:
onUploadError={(error: Error) => {
            toast.error('Something went wrong while uploading the image');
          }}
  onUploadBegin={(file: string) => {
            console.log('Upload Begin');
            console.log(file);
            decrementFileLength();
            if(remainingFileLength <= 0){
            throw new UploadThingError();
            |
          }}
Was this page helpful?