-
Notifications
You must be signed in to change notification settings - Fork 367
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
Allow limiting the number of file uploads per field #1723
Conversation
@tripflex Want to loop you in early on this one. The issue has a lot of Field Editor chatter, but haven't taken a look at what you're doing. |
I would prefer to use HTML5 validation but when we disable the upload field validation is removed.
@jom thank you, yes my plugin already has native integration for this to handle max allowed files after it wasn't ever added in core (per that issue). Just for reference, here's how i'm doing it. The template override file adds some JS to define the max upload here: Here's the JS to handle that: Here's the method used to check: |
I don't see anything that would be a major conflict right off the top of reviewing it, but i will go through and test myself to make sure, and then i can make sure to integrate with the native handling for an upcoming release (and maybe deprecate the old handling for older versions of WPJM that people may still be using). Targeting this for 1.33.0? |
@tripflex Yup, targeting it for 1.33.0 (probably a month out). Let me know if you find anything we should add/change to core's implementation. There is some stuff I don't like about Ajax uploader's validation ( |
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.
Looks good, works well! The client- and server-side validation both work for me. A couple comments below about JS i18n, but nothing critical.
Fixes #516
Changes proposed in this Pull Request:
assets/js/jquery-fileupload/jquery.fileupload.js
andassets/js/jquery-fileupload/jquery.iframe-transport.js
to their newest versions.To Do
Testing instructions:
Snippet to use/adjust:
Note:
'multiple' => false
will ignore file limit.