-1
나는 그것보다 더 큰 500킬로바이트 예 경보()
<img src="@Model.Value" width="95" height="80" id="down-load" data-id="@Model.Key" data upload="@Url.Action("AddPreview", "Images")" />
(function ($) {
$("[data-id]").each(function() {
var $this = $(this);
$($this).upload({
name: 'attachments',
action: $this.data("upload"),
enctype: 'multipart/form-data',
params: {},
autoSubmit: true,
onSubmit: function() { },
onSelect: function() {
var size = $('#down-load')[0].files[0].size;//do not work
},
onComplete: function (e) {
if (e.charAt(0) != '[') {
$.fn.showUserActionNotification(e, true);
return;
}
var data = JSON.parse(e);
if (data[0].Error) {
$.fn.showUserActionNotification(data[0].Error, true);
}
else if (data[0].Preview) {
$this.attr("src", data[0].Preview);
}
}
});
$this.parent().find("input").css("cursor", "pointer");
});
})(jQuery);
내가 그것을 확인하는 기능 onSelect를에 크기를 얻으려면 위해 줄 경우 파일을 검사 할
내보기 에 큰 시체가 나를 도울 수 있습니까?
가능한 중복이 여기에 있습니다 : http://stackoverflow.com/questions/1601455/check-file-input-size-with-jquery/3937404#3937404 – Pavlo
$ ('# down-load'). files [0] .size – Pavlo
이 함수에는 파일이 없습니다. – user246340