中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

通過XMLHttpRequest上傳文件,并顯示進(jìn)度條

2018-07-20    來源:open-open

容器云強(qiáng)勢上線!快速搭建集群,上萬Linux鏡像隨意使用
	function submitRequest(callback) {
var apkFile = document.getElementById("file").files[0];
if (apkFile) {
var fileName = apkFile.name;
var suff = fileName.substring(fileName.lastIndexOf('.') + 1,fileName.length);
if (suff != "apk") {
$.messager.alert("提示", messageCreator("文件格式必須為apk!"));
return;
}
}
var fd = new FormData();
if (apkFile) {
var apkName = apkFile.name;
fd.append("apkName", apkName);
fd.append("apkFile", apkFile);
}
var seq = $('#inputSeq').val();
fd.append("seq", seq);
fd.append("developer", $('#inputDeveloper').textbox('getText'));
fd.append("isTop", $('#inputIsTop').combobox('getValue'));
fd.append("isRecommend", $('#inputIsRecommend').combobox('getValue'));
fd.append("isRelease", $('#inputIsRelease').combobox('getValue'));
fd.append("description", $('#inputDescription').val());
var xhr = new XMLHttpRequest();
xhr.upload.addEventListener("progress", uploadProgress, false);
xhr.open('POST', AppContextPath + "/rest/app/save_app", true);
/*
xhr.onload = function() {
$.messager.alert("提示", "添加成功", null, function() {
window.top.iframeNavigator('ifrmContent','service/app_main.html');
if (callback != null)
callback();

});
};
*/
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200){
$.messager.alert("提示", "添加成功", null, function() {
window.top.iframeNavigator('ifrmContent','service/app_main.html');
if (callback != null)
callback();

});
}else if(xhr.readyState == 4&& xhr.status != 200){
var jsonError = eval("(" + xhr.responseText + ")");
var errorType = jsonError.type;
if(errorType == "ApkDuplicate"){
$.messager.alert("提示", "該Apk已經(jīng)上傳!", null, function() {window.top.iframeNavigator('ifrmContent','service/app_main.html');

});
}
}
};
xhr.send(fd);
}
function uploadProgress(evt) {
if (evt.lengthComputable) {
var percentComplete = Math.round(evt.loaded * 100 / evt.total);
document.getElementById('progressNumber').innerHTML = '<font color=red>當(dāng)前進(jìn)度:'+percentComplete.toString() + '%</font>';
}
else {
document.getElementById('progressNumber').innerHTML = 'unable to compute';
}
}

標(biāo)簽:

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:python壓縮javascript文件代碼

下一篇:php讀寫文件代碼