var index = {
validate: function () {
$("#uploadmodal").on('shown.bs.modal', function () {
$("#submit").on('click', function (event) {
event.stopPropagation();
if (index.validPhoto){
alert('success');
console.log(index.validPhoto);
}else {
alert('error');
console.log(index.validPhoto);
}
})
});
},
validPhoto:null,
_validateFile: function () {
$('#inputfile').checkFileTypeAndSize({
allowedExtensions: ['txt','png'],
maxSize: 5000,
success: function() {
index[validPhoto] = true;
},
extensionerror: function() {
alert('允许的格式为:txt,png !');
index[validPhoto] = false;
},
sizeerror: function() {
alert('最大尺寸500KB !');
index.validPhoto = false;
}
});
},
我想通过下面的函数验证文件是否符合规则,想法是通过验证规则修改validphoto,之后将validphoto传入,但是修改不成功,求指点 是不是这种写法就不对呢
相关分类