$table.append($tr);
function uploadProgress(evt) {
if (evt.lengthComputable) {
var percentComplete = Math.round(evt.loaded * 100 / evt.total);
$tr.find('.upload_status').html(Math.round(percentComplete) + '%');
} else {
$tr.find('.upload_status').html('unable to compute');
}
}
function uploadComplete(evt) {
if (evt.target.status == 200) {
$tr.find('.upload_status').html('已完成');
$tr.find('.upload_action a').html('删除');
if (typeof opt.fnComplete == 'function') {
opt.fnComplete(evt.target.response);
}
$tr.find('.upload_action').unbind('click').bind('click', removeFile);
}
}
function uploadFailed() {
$tr.find('.upload_status').html('<a href="javascript:void(0);">×</a>');
$tr.find('.upload_status a').unbind('click').bind('click', function() {
$tr.remove();
});
$tr.find('.upload_action a').html('重试');
$tr.find('.upload_action a').unbind('click').bind('click', function() {
xhr.send(fd);
});
}
function uploadCanceled() {
$tr.remove();
}
function removeFile() {
$tr.remove();
if (typeof opt.fnRemove == 'function') {
opt.fnRemove(file.name);
}
}
xhr.send(fd);
}, false);
});
};
}(jQuery));
5.代码查看地址:https://github.com/kencery/Common/tree/master/KenceryCommonMethod/%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0
以上所述就是本文的全部内容了,希望大家能够喜欢。










