Yuvaleros / material-ui-dropzone

A Material-UI file upload dropzone
MIT License
485 stars 245 forks source link

Let user access dropped files when file limit is exceeded #356

Closed K02D closed 1 year ago

K02D commented 2 years ago

Description

Currently, if files are dropped and the total file count exceeds the filesLimit, the dropped files that cause the filesLimit to be exceeded are not accessible by the user through any prop. If we look at the relevant code here, we see that we terminate the function without passing the files to any prop handler like onDrop

image

I added a new prop that lets the user access the files that cause the filesLimit to be exceeded. Files that are rejected on drop are accessible using the onDropRejected prop - however, onDropRejected does not return dropped files that cause the filesLimit to be exceeded because these files are not rejected by react-dropzone but instead accepted.

Codesandbox link to demonstrate the bug

Type of change

How Has This Been Tested

Test Configuration:

Checklist

K02D commented 2 years ago

@panz3r Sorry to ping you but if you could have a look at my PR that'd be great!