优化 Upload 文件上传组件一些参数,默认从后台获取

This commit is contained in:
thinkgem
2025-10-27 09:15:22 +08:00
parent 854591cc2e
commit 037918e8e5
2 changed files with 11 additions and 6 deletions

View File

@@ -45,14 +45,19 @@ public class FileUploadController extends BaseController {
@ResponseBody
public Map<String, Object> params() {
Map<String, Object> model = MapUtils.newHashMap();
model.put("maxFileSize", Global.getConfigToLong("file.maxFileSize", "500*1024*1024"));
model.put("imageAllowSuffixes", Global.getConfig("file.imageAllowSuffixes", FileUploadParams.DEFAULT_IMAGE_ALLOW_SUFFIXES));
model.put("mediaAllowSuffixes", Global.getConfig("file.mediaAllowSuffixes", FileUploadParams.DEFAULT_MEDIA_ALLOW_SUFFIXES));
model.put("fileAllowSuffixes", Global.getConfig("file.fileAllowSuffixes", FileUploadParams.DEFAULT_FILE_ALLOW_SUFFIXES));
model.put("chunked", Global.getConfig("file.chunked", "true"));
model.put("chunkSize", Global.getConfigToInteger("file.chunkSize", "10*1024*1024"));
model.put("threads", Global.getConfigToInteger("file.threads", "3"));
model.put("imageMaxWidth", Global.getConfigToInteger("file.imageMaxWidth", "1024"));
model.put("imageMaxHeight", Global.getConfigToInteger("file.imageMaxHeight", "768"));
model.put("checkmd5", Global.getConfigToBoolean("file.checkmd5", "true"));
model.put("chunked", Global.getConfigToBoolean("file.chunked", "true"));
model.put("chunkSize", Global.getConfigToInteger("file.chunkSize", "10*1024*1024"));
model.put("threads", Global.getConfigToInteger("file.threads", "3"));
return model;
}

View File

@@ -161,9 +161,9 @@ $(function() {
fileNameInputId: '${p.fileNameInputId}',
uploadType: '${p.uploadType}',
maxFileSize: "#{isNotBlank(p.maxFileSize)?p.maxFileSize:@Global.getConfig('file.maxFileSize', '500*1024*1024')}",
imageAllowSuffixes: '${isNotBlank(p.allowSuffixes)?p.allowSuffixes:@Global.getConfig("file.imageAllowSuffixes", ".gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff,.webp,")}',
mediaAllowSuffixes: '${isNotBlank(p.allowSuffixes)?p.allowSuffixes:@Global.getConfig("file.mediaAllowSuffixes", ".flv,.swf,.mkv,webm,.mid,.mov,.mp3,.mp4,.m4v,.mpc,.mpeg,.mpg,.swf,.wav,.wma,.wmv,.avi,.rm,.rmi,.rmvb,.aiff,.asf,.ogg,.ogv,")}',
fileAllowSuffixes: '${isNotBlank(p.allowSuffixes)?p.allowSuffixes:@Global.getConfig("file.fileAllowSuffixes", ".doc,.docx,.rtf,.xls,.xlsx,.csv,.ppt,.pptx,.pdf,.ofd,.vsd,.txt,.md,.xml,.rar,.zip,.7z,.tar,.tgz,.jar,.gz,.gzip,.bz2,.cab,.iso,")}',
imageAllowSuffixes: '${isNotBlank(p.allowSuffixes)?p.allowSuffixes:@Global.getConfig("file.imageAllowSuffixes", @com.jeesite.modules.file.entity.FileUploadParams.DEFAULT_IMAGE_ALLOW_SUFFIXES)}',
mediaAllowSuffixes: '${isNotBlank(p.allowSuffixes)?p.allowSuffixes:@Global.getConfig("file.mediaAllowSuffixes", @com.jeesite.modules.file.entity.FileUploadParams.DEFAULT_MEDIA_ALLOW_SUFFIXES)}',
fileAllowSuffixes: '${isNotBlank(p.allowSuffixes)?p.allowSuffixes:@Global.getConfig("file.fileAllowSuffixes", @com.jeesite.modules.file.entity.FileUploadParams.DEFAULT_FILE_ALLOW_SUFFIXES)}',
chunked: "#{__info_type=='0'?false:@Global.getConfig('file.chunked', 'true')}",
chunkSize: "#{@Global.getConfigToInteger('file.chunkSize', '10*1024*1024')}",
threads: "#{@Global.getConfigToInteger('file.threads', '3')}",