update ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java.

pull/319/head
Hacker 3 years ago committed by Gitee
parent 4142a733b8
commit e8782ab4bf

@ -103,19 +103,18 @@ public class CommonController
{
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
String fileNames = "";
String urls = "";
for (MultipartFile file : files)
{
List<String> fileNames = new ArrayList<>();
List<String> urls = new ArrayList<>();
for (MultipartFile file : files) {
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
fileNames += fileName + FILE_DELIMETER;
urls += url + FILE_DELIMETER;
fileNames.add(fileName);
urls.add(url);
}
AjaxResult ajax = AjaxResult.success();
ajax.put("fileNames", StringUtils.lastStringDel(fileNames, FILE_DELIMETER));
ajax.put("urls", StringUtils.lastStringDel(urls, FILE_DELIMETER));
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
return ajax;
}
catch (Exception e)

Loading…
Cancel
Save