0
我必须验证图像上传字段使用jQuery。 有没有什么办法可以将图像大小限制为最大5MB?Jquery验证图像大小
我的工作形象的验证方法如下: jQuery.validator.addMethod("imagesonly", function (value, element) { return this.optional(element) || /([^\s]+(?=\.(jpg|gif|png))\.\2)/gm.test(value); }, "Please enter valid image.");
我需要在此添加代码,从而限制了图像尺寸最大为5 MB。
看看这个:http://adamsanderson.github.io/jQuery-File-Validator/ –
http://stackoverflow.com/a/10427219/1283215 –