Browse Source

预警

dev_kxc
ljf 1 year ago
parent
commit
4d95375acf
  1. 18
      jwtech-pc/src/main/java/com/kms/web/controller/common/CommonController.java

18
jwtech-pc/src/main/java/com/kms/web/controller/common/CommonController.java

@ -61,22 +61,24 @@ public class CommonController
{
try
{
String uploadType = JianweiConfig.getUploadType();
if (uploadType.equals("disk")) {
// 本地资源路径
String localPath = JianweiConfig.getProfile();
// String localPath = JianweiConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(fileName, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
// String downloadPath = localPath + StringUtils.substringAfter(fileName, Constants.RESOURCE_PREFIX);
// // 下载名称
// String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
String filePath = JianweiConfig.getDownloadPath() + fileName;
response.setCharacterEncoding("utf-8");
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition",
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
FileUtils.writeBytes(downloadPath, response.getOutputStream());
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
FileUtils.writeBytes(filePath, response.getOutputStream());
} else {
response.setCharacterEncoding("utf-8");

Loading…
Cancel
Save