You are making one of two possible errors:
- using the wrong rule for validating the file extension.
- using the wrong parameters for validating the
mime-type
.
The accept
method is only for validating by mime-type
.
Assuming you want to validate by file extension, then you'll need to use the extension
method.
Read and compare the documentation for the two methods: extension
and accept
.
Both accept
and extension
are part of the plugin's own additional-methods.js
file.
$("#addNewDocumentForm").validate({
rules: {
inputDocument: {
required: true,
extension: "png|jpg|gif|pdf"
}
},
messages: {
inputDocument: "File must be PNG, JPG, GIF or PDF"
},
submitHandler: function(form) {
...