完成文件上传管理

This commit is contained in:
augushong
2021-06-19 18:41:05 +08:00
parent ae9f2c6999
commit 1be98f85b6
30 changed files with 51988 additions and 163 deletions

View File

@@ -26,7 +26,7 @@ function renderUpload(target, params) {
var type = params.type
}
if(typeof window.uploadAddressPrefix == 'undefined'){
if (typeof window.uploadAddressPrefix == 'undefined') {
window.uploadAddressPrefix = '/api/'
}
@@ -109,4 +109,18 @@ function renderUpload(target, params) {
layer.close(window.uploading)
}
})
}
function formatSize(filesize) {
var value = filesize
if (null == value || value == '') {
return "0 Bytes";
}
var unitArr = new Array("Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
var index = 0;
var srcsize = parseFloat(value);
index = Math.floor(Math.log(srcsize) / Math.log(1024));
var size = srcsize / Math.pow(1024, index);
size = size.toFixed(2);//保留的小数位数
return size + unitArr[index];
}