// Javascript code for checking total document size.
var filesize1 = 0;
var filesize2 = 0;
var filesize3 = 0;
var filesize4 = 0;
var filesize5 = 0;
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '02' + '_fuReuploadPath').bind('change', function () {
filesize1 = Math.round(this.files[0].size / 1024);
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '02' + '_lblFU').text(filesize1 + "KB");
EnableDisableUpdate();
});
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '03' + '_fuReuploadPath').bind('change', function () {
filesize2 = Math.round(this.files[0].size / 1024);
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '03' + '_lblFU').text(filesize2 + "KB");
EnableDisableUpdate();
});
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '04' + '_fuReuploadPath').bind('change', function () {
filesize3 = Math.round(this.files[0].size / 1024);
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '04' + '_lblFU').text(filesize3 + "KB");
EnableDisableUpdate();
});
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '05' + '_fuReuploadPath').bind('change', function () {
filesize4 = Math.round(this.files[0].size / 1024);
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '05' + '_lblFU').text(filesize4 + "KB");
EnableDisableUpdate();
});
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '06' + '_fuReuploadPath').bind('change', function () {
filesize5 = Math.round(this.files[0].size / 1024);
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '06' + '_lblFU').text(filesize5 + "KB");
EnableDisableUpdate();
});
function EnableDisableUpdate() {
if ((filesize1 + filesize2 + filesize3 + filesize4 + filesize5) > 10000) {
changeColor('red');
$('#ctl00_ContentPlaceHolder1_btnUpload').attr('disabled', 'disabled');
alert("Document size more than 10 MB please reduce size.");
} else {
changeColor('green');
$('#ctl00_ContentPlaceHolder1_btnUpload').removeAttr('disabled');
}
}
function changeColor(color) {
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '02' + '_lblFU').css({ color: color });
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '03' + '_lblFU').css({ color: color });
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '04' + '_lblFU').css({ color: color });
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '05' + '_lblFU').css({ color: color });
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '06' + '_lblFU').css({ color: color });
}
var filesize1 = 0;
var filesize2 = 0;
var filesize3 = 0;
var filesize4 = 0;
var filesize5 = 0;
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '02' + '_fuReuploadPath').bind('change', function () {
filesize1 = Math.round(this.files[0].size / 1024);
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '02' + '_lblFU').text(filesize1 + "KB");
EnableDisableUpdate();
});
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '03' + '_fuReuploadPath').bind('change', function () {
filesize2 = Math.round(this.files[0].size / 1024);
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '03' + '_lblFU').text(filesize2 + "KB");
EnableDisableUpdate();
});
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '04' + '_fuReuploadPath').bind('change', function () {
filesize3 = Math.round(this.files[0].size / 1024);
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '04' + '_lblFU').text(filesize3 + "KB");
EnableDisableUpdate();
});
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '05' + '_fuReuploadPath').bind('change', function () {
filesize4 = Math.round(this.files[0].size / 1024);
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '05' + '_lblFU').text(filesize4 + "KB");
EnableDisableUpdate();
});
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '06' + '_fuReuploadPath').bind('change', function () {
filesize5 = Math.round(this.files[0].size / 1024);
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '06' + '_lblFU').text(filesize5 + "KB");
EnableDisableUpdate();
});
function EnableDisableUpdate() {
if ((filesize1 + filesize2 + filesize3 + filesize4 + filesize5) > 10000) {
changeColor('red');
$('#ctl00_ContentPlaceHolder1_btnUpload').attr('disabled', 'disabled');
alert("Document size more than 10 MB please reduce size.");
} else {
changeColor('green');
$('#ctl00_ContentPlaceHolder1_btnUpload').removeAttr('disabled');
}
}
function changeColor(color) {
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '02' + '_lblFU').css({ color: color });
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '03' + '_lblFU').css({ color: color });
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '04' + '_lblFU').css({ color: color });
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '05' + '_lblFU').css({ color: color });
$('#ctl00_ContentPlaceHolder1_gvReuploadDocs_ctl' + '06' + '_lblFU').css({ color: color });
}
No comments:
Post a Comment