I have a file upload field in my form and I am validating that field using jquery validation like the following:
My Input tag:
<input type="file" id="photo" name="photo" />
Validation:
$('#create_teacher').validate({
rules: {
photo:{
required: true,
extension: "jpeg,jpg,gif,png"
},
},
messages: {
photo: { // <- this refers to the NAME attribute, NOT id.
required: "this field is mandatory",
extension: "accepts jpeg, jpg, gif or png"
}
}
});
can anyone help me in this .