react-widget icon indicating copy to clipboard operation
react-widget copied to clipboard

Problem with multiple files when multimax option is set

Open ehudmi opened this issue 3 years ago • 1 comments

Question

I'm trying to limit the number of files uploaded on an instance of the widget. My problem is that I can select more than the specified limit and I get a message specifying the limit.... However the selected files still get uploaded. example: I set the limit to 3 files. I can select 5 files in the selection window and when the selection window closes the widget reports only 3 files may be selected. When I check my project on uploadcare I see all 5 were uploaded. What am I doing wrong?

ehudmi avatar Nov 17 '22 16:11 ehudmi

Hey @ehudmi, this is expected behaviour. Widget uploads all files regardless of the limit, it just doesn't let the user submit if the number of files isn't fit the limit.

But you could subscribe to the new files and cancel uploading if their number doesn't fit. Here is the example - https://codesandbox.io/embed/cancel-extra-uploads-1h0ibj?codemirror=1

nd0ut avatar Dec 23 '22 09:12 nd0ut