Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 8, 2017

Conversation

RobJohnston
Copy link
Contributor

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.

Copy link
Member

@Arkni Arkni left a 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!


if ( $( element ).attr( "type" ) === "file" ) {
if ( element.files && element.files.length ) {
if ( element.files.length > param ) {
Copy link
Member

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 two if blocks?

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, 8 and 9.

@@ -0,0 +1,16 @@
//Limit the number of files in a FileList.
Copy link
Member

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.

@RobJohnston
Copy link
Contributor Author

@Arkni Done.

@Arkni Arkni merged commit 7e9e478 into jquery-validation:master Oct 8, 2017
@Arkni
Copy link
Member

Arkni commented Oct 8, 2017

Thanks a lot for your contribution :)

@RobJohnston RobJohnston deleted the file_max_size branch October 8, 2017 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy