mirror of
https://gitee.com/ulthon/ul-file-share.git
synced 2026-07-08 21:52:48 +08:00
完成文件上传管理
This commit is contained in:
@@ -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];
|
||||
}
|
||||
Reference in New Issue
Block a user