...
|
...
|
@@ -95,22 +95,37 @@ $.fn.ajaxfileupload = function(options) { |
|
|
var width = $(img).width(),
|
|
|
height = $(img).height();
|
|
|
|
|
|
if (settings.valid_spec == true
|
|
|
&& (Math.abs(width - settings.width_limit) > 10
|
|
|
|| Math.abs(height - settings.height_limit) > 10) ) {
|
|
|
// 图片规格超出限制
|
|
|
settings.onComplete.apply($element, [{
|
|
|
status: false,
|
|
|
message: '只允许上传' + settings.width_limit + '*' + settings.height_limit + '的文件,第' + (index+1) + '个文件不符合要求'
|
|
|
}, settings.params]);
|
|
|
var _$element = $element.clone();
|
|
|
var _$parent = $element.parent();
|
|
|
$element.remove();
|
|
|
_$parent.append(_$element);
|
|
|
_$element.ajaxfileupload(settings);
|
|
|
}
|
|
|
if (settings.valid_spec == true && (Math.abs(width - settings.width_limit) > 10 || Math.abs(height - settings.height_limit) > 10) )
|
|
|
{
|
|
|
// 图片规格超出限制
|
|
|
settings.onComplete.apply($element, [{
|
|
|
status: false,
|
|
|
message: '只允许上传' + settings.width_limit + '*' + settings.height_limit + '的文件,第' + (index+1) + '个文件不符合要求'
|
|
|
}, settings.params]);
|
|
|
var _$element = $element.clone();
|
|
|
var _$parent = $element.parent();
|
|
|
$element.remove();
|
|
|
_$parent.append(_$element);
|
|
|
_$element.ajaxfileupload(settings);
|
|
|
}
|
|
|
// 校验通过,上传至服务器
|
|
|
uploading_file = true;
|
|
|
// 记录文件的原始尺寸
|
|
|
settings.params.attrs = {
|
|
|
width: width,
|
|
|
height: height,
|
|
|
size: file.size
|
|
|
};
|
|
|
|
|
|
var ret = settings.onStart.apply($element, [settings.params]);
|
|
|
wrapElement($element);
|
|
|
if (ret !== false) {
|
|
|
$element.parent('form').submit(function (e) {
|
|
|
e.stopPropagation();
|
|
|
}).submit();
|
|
|
}
|
|
|
// }
|
|
|
};
|
|
|
};
|
|
|
|
|
|
|
|
|
if (file.size / 1024 > settings.size_limit) {
|
...
|
...
|
|