Bootstrap Validator не работает при вводе файла ⇐ Jquery
-
Anonymous
Bootstrap Validator не работает при вводе файла
I have a form field that should only accept a .jpg or .png image at a certain file size. The validation doesn't seem to be working(tested with invalid file types). This is what I have so far, so what is it I'm missing? I should work like it does here http://bootstrapvalidator.com/validators/file/
jsFiddle: http://jsfiddle.net/933yvfmh/3/
Image Cropper Reset //HIDE CONTROLS UNTIL IMAGE SELECTED// $("#reset, #renderButton, .render").hide(); $("#file").click(function () { $("#reset, #renderButton").show(); }); //ONLY SHOW RENDERED VIEW WHEN RENDER BUTTON CLICKED// $("#renderButton").click(function () { $(".render").fadeIn("slow").animate({ right: '50px' }); $(".render, #result_container").show(); }) //RESET RENDER VIEW// $("#reset").click(function () { $(".imgly-container").empty(); }); $('#fileupload').bootstrapValidator({ live: 'enabled', fields: { fileupload: { validators: { file: { extension: 'jpg, png', type: 'image/jpg, image/png', minSize: 1024 * 1024, message: 'The selected file is not valid, or the size is not large enough!' } } } } });
Источник: https://stackoverflow.com/questions/260 ... file-input
I have a form field that should only accept a .jpg or .png image at a certain file size. The validation doesn't seem to be working(tested with invalid file types). This is what I have so far, so what is it I'm missing? I should work like it does here http://bootstrapvalidator.com/validators/file/
jsFiddle: http://jsfiddle.net/933yvfmh/3/
Image Cropper Reset //HIDE CONTROLS UNTIL IMAGE SELECTED// $("#reset, #renderButton, .render").hide(); $("#file").click(function () { $("#reset, #renderButton").show(); }); //ONLY SHOW RENDERED VIEW WHEN RENDER BUTTON CLICKED// $("#renderButton").click(function () { $(".render").fadeIn("slow").animate({ right: '50px' }); $(".render, #result_container").show(); }) //RESET RENDER VIEW// $("#reset").click(function () { $(".imgly-container").empty(); }); $('#fileupload').bootstrapValidator({ live: 'enabled', fields: { fileupload: { validators: { file: { extension: 'jpg, png', type: 'image/jpg, image/png', minSize: 1024 * 1024, message: 'The selected file is not valid, or the size is not large enough!' } } } } });
Источник: https://stackoverflow.com/questions/260 ... file-input
Мобильная версия