Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Additional: max size and number of files#2087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for working on this.
Overall, it looks good to me. Only two small changes and we are good to go.
Thanks!
src/additional/maxfiles.js Outdated
if ( $( element ).attr( "type" ) === "file" ) { | ||
if ( element.files && element.files.length ) { | ||
if ( element.files.length > param ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you please merge the above twoif
blocks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Which two? There are three of them. Lines 8 and 9, I presume?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yes, 8 and 9.
src/additional/maxfiles.js Outdated
@@ -0,0 +1,16 @@ | |||
//Limit the number of files in a FileList. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Just for consistency with the other comments in this project, can you add a space before the comment?
The same goes for other comments bellow.
@Arkni Done. |
Thanks a lot for your contribution :) |
This is a continuation of abandoned PR#1512, in that it validates the maximum size of a selected file.
Since the "file" type can contain the multiple attribute, another method was added to validate the maximum size of all selected files. Finally, a third method was added to validate the maximum number of files.