Custom Fields
Re-Envisioned
Support General File Upload Validation

  • Creator
    Topic
  • #16096
    Ranadeep Ghose
    Participant

    Hi,

    I’m require my file upload to only allow PDFs. I have used the following code but it does not work. Please help me point out how to do it.

    https://pastebin.com/1dgyYf0M

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #16110
    Anh Tran
    Keymaster

    Hi Ranadeep,

    The extension validation is an add-on for the jQuery validation library and it’s not included in Meta Box.

    In order to use it, please download the extension.js file from Github:

    https://github.com/jquery-validation/jquery-validation/blob/master/src/additional/extension.js

    And enqueue it like this:

    add_action( 'rwmb_enqueue_scripts', function() {
        wp_enqueue_script( 'jquery-validation-extension', 'url to the js file', '', '', true );
    }

    Then you can use the extension rule.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.