You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 23, 2020. It is now read-only.
I want validate file name format to prevent files names like "this.is.an.image.png".
I have jquery validation on my page and the next jquery validate script:
<script>
$.validator.addMethod("checkFileName", function(value, element) {
return this.optional(element) || /\\([a-z0-9])*\.(jpg|png|jpeg)/i.test(value);
}, "El nombre de la imagen no puede tener puntos.");
var $validator = $("#editarCabecera").validate({
errorClass: "is-invalid",
errorElement: "errorLabel",
validClass: "is-valid",
rules: {
textoGrande: {
required: true
},
imagen: {
required: true,
checkFileName: true
}
},
messages: {
textoGrande: {
required: ""
},
imagen: {
required: ""
}
}
});
</script>