修复 upload size 提示错误
This commit is contained in:
parent
f12f08e6c5
commit
c9f80d74fc
@ -89,7 +89,7 @@ layui.use('upload', function(){
|
|||||||
var uploadInst = upload.render({
|
var uploadInst = upload.render({
|
||||||
elem: '#test1'
|
elem: '#test1'
|
||||||
,url: '/upload/'
|
,url: '/upload/'
|
||||||
//,size: 60 //限制文件大小,单位 KB
|
,size: 2000 //限制文件大小,单位 KB
|
||||||
,accept: 'file'
|
,accept: 'file'
|
||||||
,fileAccept: 'image/*'
|
,fileAccept: 'image/*'
|
||||||
,exts: "jpg|png|gif|bmp|jpeg|pdf"
|
,exts: "jpg|png|gif|bmp|jpeg|pdf"
|
||||||
|
@ -381,12 +381,9 @@ layui.define('layer' , function(exports){
|
|||||||
layui.each(that.chooseFiles, function(index, file){
|
layui.each(that.chooseFiles, function(index, file){
|
||||||
if(file.size > 1024*options.size){
|
if(file.size > 1024*options.size){
|
||||||
var size = options.size/1024;
|
var size = options.size/1024;
|
||||||
size = size >= 1
|
size = size >= 1 ? (size.toFixed(2) + 'MB') : options.size + 'KB'
|
||||||
? (Math.floor(size) + (size%1 > 0 ? size.toFixed(1) : 0)) + 'MB'
|
|
||||||
: options.size + 'KB'
|
|
||||||
elemFile.value = '';
|
elemFile.value = '';
|
||||||
limitSize = size;
|
limitSize = size;
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(limitSize) return that.msg('文件不能超过'+ limitSize);
|
if(limitSize) return that.msg('文件不能超过'+ limitSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user