From dfd4250f47bd893dc3650bfaa1d1ebbc7bbb3f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=84=9D=20=EC=B5=9C?= Date: Fri, 14 Jan 2022 15:41:52 +0900 Subject: [PATCH] =?UTF-8?q?=ED=99=95=EC=9E=A5=EC=9E=90=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95.=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=A0=80=EC=9E=A5,=20=EB=8B=A4=EC=9A=B4?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kcgfilemanager/config/SecurityConfig.java | 3 +- .../controller/BoardController.java | 142 --------------- .../controller/FileController.java | 169 ++++++++++++++++++ .../controller/adminController.java | 2 - .../service/BoardCategoryService.java | 6 +- .../kcgfilemanager/service/BoardService.java | 37 +++- .../service/FileInfoService.java | 6 +- src/main/resources/application-dev.properties | 3 +- .../resources/application-prod.properties | 3 +- .../resources/application-test.properties | 3 +- .../resources/static/js/board/contentList.js | 4 +- 11 files changed, 212 insertions(+), 166 deletions(-) create mode 100644 src/main/java/com/dbnt/kcgfilemanager/controller/FileController.java diff --git a/src/main/java/com/dbnt/kcgfilemanager/config/SecurityConfig.java b/src/main/java/com/dbnt/kcgfilemanager/config/SecurityConfig.java index 02189cc..b7620b1 100644 --- a/src/main/java/com/dbnt/kcgfilemanager/config/SecurityConfig.java +++ b/src/main/java/com/dbnt/kcgfilemanager/config/SecurityConfig.java @@ -33,8 +33,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() // 페이지 권한 설정 - .antMatchers("/board/**").hasRole(Role.USER.name()) // USER, ADMIN 접근 허용 - .antMatchers("/info/**").hasRole(Role.USER.name()) // USER, ADMIN 접근 허용 + .antMatchers("/file/**", "/board/**", "/info/**").hasRole(Role.USER.name()) // USER, ADMIN 접근 허용 .antMatchers("/admin/**").hasRole(Role.ADMIN.name()) // ADMIN만 접근 허용 .antMatchers("/user/login").permitAll() // 로그인 페이지는 권한 없이 접근 허용 .and() // 로그인 설정 diff --git a/src/main/java/com/dbnt/kcgfilemanager/controller/BoardController.java b/src/main/java/com/dbnt/kcgfilemanager/controller/BoardController.java index e3de793..e131c75 100644 --- a/src/main/java/com/dbnt/kcgfilemanager/controller/BoardController.java +++ b/src/main/java/com/dbnt/kcgfilemanager/controller/BoardController.java @@ -6,24 +6,12 @@ import com.dbnt.kcgfilemanager.service.BoardCategoryService; import com.dbnt.kcgfilemanager.service.BoardService; import com.dbnt.kcgfilemanager.service.CategoryRoleService; import lombok.RequiredArgsConstructor; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.annotation.AuthenticationPrincipal; -import org.springframework.util.FileCopyUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.*; -import java.net.URLEncoder; -import java.security.Principal; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; import java.util.List; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; @RestController @RequiredArgsConstructor @@ -135,134 +123,4 @@ public class BoardController { return mav; } - @GetMapping("/fileDownload") - public void fileDownload(Principal principal, Integer contentSeq, Integer fileSeq, HttpServletRequest request, HttpServletResponse response){ - FileInfo downlodFileInfo = boardService.selectDownloadFileInfo(contentSeq, fileSeq, ((UserInfo)((UsernamePasswordAuthenticationToken) principal).getPrincipal()).getUserId()); - - BufferedInputStream in; - BufferedOutputStream out; - try { - File file = new File(downlodFileInfo.getSavePath(), downlodFileInfo.getConversionName()); - setDisposition(downlodFileInfo.getFullName(), request, response); - in = new BufferedInputStream(new FileInputStream(file)); - out = new BufferedOutputStream(response.getOutputStream()); - FileCopyUtils.copy(in, out); - out.flush(); - if(out!=null) out.close(); - if(in!=null )in.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @GetMapping("/fileDownloadToZip") - public void fileDownloadToZip(Principal principal, Integer contentSeq, @RequestParam(value = "fileSeq") List fileSeqList, HttpServletResponse response){ - List targetList = boardService.selectDownloadFileInfoList(contentSeq, fileSeqList, ((UserInfo)((UsernamePasswordAuthenticationToken) principal).getPrincipal()).getUserId()); - - BufferedInputStream in; - BufferedOutputStream out; - - String tempZipPath = "C:\\kcgFileManager\\tempZip\\"; - File tempFolder = new File(tempZipPath); - if (!tempFolder.exists() || tempFolder.isFile()) { - tempFolder.mkdirs(); - } - String downloadFileName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); - - tempZipPath += downloadFileName+".zip"; - try{ - FileOutputStream fout = new FileOutputStream(tempZipPath); - ZipOutputStream zout = new ZipOutputStream(fout); - for(FileInfo downLoadFile: targetList){ - ZipEntry zipEntry = new ZipEntry(downLoadFile.getFullName()); - zout.putNextEntry(zipEntry); - - FileInputStream fin = new FileInputStream(downLoadFile.getSavePath()+"\\"+downLoadFile.getConversionName()); - byte[] buffer = new byte[1024]; - int length; - while((length = fin.read(buffer)) > 0){ - zout.write(buffer, 0, length); - } - - zout.closeEntry(); - fin.close(); - } - zout.close(); - - response.setContentType("application/zip"); - response.addHeader("Content-Disposition", "attachment; filename="+downloadFileName+".zip"); - - FileInputStream fis=new FileInputStream(tempZipPath); - ServletOutputStream so=response.getOutputStream(); - in=new BufferedInputStream(fis); - out=new BufferedOutputStream(so); - - byte[] data=new byte[2048]; - int input; - while((input=in.read(data))!=-1){ - out.write(data,0,input); - out.flush(); - } - - if(out!=null) out.close(); - if(fis!=null) fis.close(); - if(in!=null) in.close(); - if(so!=null) so.close(); - }catch (IOException e){ - e.printStackTrace(); - } finally { - File tempZip = new File(tempZipPath); - tempZip.delete(); - } - } - - private void setDisposition(String filename, HttpServletRequest request, HttpServletResponse response) throws IOException { - String browser = getBrowser(request); - - String dispositionPrefix = "attachment; filename="; - String encodedFilename = null; - - if (browser.equals("MSIE")) { - encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20"); - } else if (browser.equals("Trident")) { // IE11 문자열 깨짐 방지 - encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20"); - } else if (browser.equals("Firefox")) { - encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\""; - } else if (browser.equals("Opera")) { - encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\""; - } else if (browser.equals("Chrome")) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < filename.length(); i++) { - char c = filename.charAt(i); - if (c > '~') { - sb.append(URLEncoder.encode("" + c, "UTF-8")); - } else { - sb.append(c); - } - } - encodedFilename = sb.toString(); - } else { - throw new IOException("Not supported browser"); - } - - response.setHeader("Content-Disposition", dispositionPrefix + encodedFilename); - - if ("Opera".equals(browser)) { - response.setContentType("application/octet-stream;charset=UTF-8"); - } - } - - private String getBrowser(HttpServletRequest request) { - String header = request.getHeader("User-Agent"); - if (header.indexOf("MSIE") > -1) { - return "MSIE"; - } else if (header.indexOf("Trident") > -1) { // IE11 문자열 깨짐 방지 - return "Trident"; - } else if (header.indexOf("Chrome") > -1) { - return "Chrome"; - } else if (header.indexOf("Opera") > -1) { - return "Opera"; - } - return "Firefox"; - } } diff --git a/src/main/java/com/dbnt/kcgfilemanager/controller/FileController.java b/src/main/java/com/dbnt/kcgfilemanager/controller/FileController.java new file mode 100644 index 0000000..a1e2e32 --- /dev/null +++ b/src/main/java/com/dbnt/kcgfilemanager/controller/FileController.java @@ -0,0 +1,169 @@ +package com.dbnt.kcgfilemanager.controller; + +import com.dbnt.kcgfilemanager.model.FileInfo; +import com.dbnt.kcgfilemanager.model.UserInfo; +import com.dbnt.kcgfilemanager.service.BoardService; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.util.FileCopyUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.security.Principal; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/file") +public class FileController { + + private final BoardService boardService; + + @Value("${spring.servlet.multipart.location}") + private String locationPath; + + @GetMapping("/fileDownload") + public void fileDownload(Principal principal, Integer contentSeq, Integer fileSeq, HttpServletRequest request, HttpServletResponse response){ + FileInfo downloadFile = boardService.selectDownloadFileInfo(contentSeq, fileSeq, ((UserInfo)((UsernamePasswordAuthenticationToken) principal).getPrincipal()).getUserId()); + + BufferedInputStream in; + BufferedOutputStream out; + try { + File file = new File(downloadFile.getSavePath(), downloadFile.getConversionName()); + + setDisposition(downloadFile.getFullName(), request, response); + in = new BufferedInputStream(new FileInputStream(file)); + out = new BufferedOutputStream(response.getOutputStream()); + FileCopyUtils.copy(in, out); + out.flush(); + if(out!=null) out.close(); + if(in!=null )in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @GetMapping("/fileDownloadToZip") + public void fileDownloadToZip(Principal principal, Integer contentSeq, @RequestParam(value = "fileSeq") List fileSeqList, HttpServletResponse response){ + List targetList = boardService.selectDownloadFileInfoList(contentSeq, fileSeqList, ((UserInfo)((UsernamePasswordAuthenticationToken) principal).getPrincipal()).getUserId()); + + BufferedInputStream in; + BufferedOutputStream out; + + String tempZipPath = locationPath+File.separator+"tempZip"+File.separator; + File tempFolder = new File(tempZipPath); + if (!tempFolder.exists() || tempFolder.isFile()) { + tempFolder.mkdirs(); + } + String downloadFileName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); + + tempZipPath += downloadFileName+".zip"; + + try{ + FileOutputStream fout = new FileOutputStream(tempZipPath); + ZipOutputStream zout = new ZipOutputStream(fout); + for(FileInfo downLoadFile: targetList){ + ZipEntry zipEntry = new ZipEntry(downLoadFile.getFullName()); + zout.putNextEntry(zipEntry); + File savedFile = new File(downLoadFile.getSavePath(), downLoadFile.getConversionName()); + FileInputStream fin = new FileInputStream(savedFile); + byte[] buffer = new byte[1024]; + int length; + while((length = fin.read(buffer)) > 0){ + zout.write(buffer, 0, length); + } + + zout.closeEntry(); + fin.close(); + } + zout.close(); + + response.setContentType("application/zip"); + response.addHeader("Content-Disposition", "attachment; filename="+downloadFileName+".zip"); + + FileInputStream fis=new FileInputStream(tempZipPath); + ServletOutputStream so=response.getOutputStream(); + in=new BufferedInputStream(fis); + out=new BufferedOutputStream(so); + + byte[] data=new byte[2048]; + int input; + while((input=in.read(data))!=-1){ + out.write(data,0,input); + out.flush(); + } + + if(out!=null) out.close(); + if(fis!=null) fis.close(); + if(in!=null) in.close(); + if(so!=null) so.close(); + }catch (IOException e){ + e.printStackTrace(); + } finally { + File tempZip = new File(tempZipPath); + tempZip.delete(); + } + } + + private void setDisposition(String filename, HttpServletRequest request, HttpServletResponse response) throws IOException { + String browser = getBrowser(request); + + String dispositionPrefix = "attachment; filename="; + String encodedFilename = null; + + if (browser.equals("MSIE")) { + encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20"); + } else if (browser.equals("Trident")) { // IE11 문자열 깨짐 방지 + encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20"); + } else if (browser.equals("Firefox")) { + encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\""; + } else if (browser.equals("Opera")) { + encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\""; + } else if (browser.equals("Chrome")) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < filename.length(); i++) { + char c = filename.charAt(i); + if (c > '~') { + sb.append(URLEncoder.encode("" + c, "UTF-8")); + } else { + sb.append(c); + } + } + encodedFilename = sb.toString(); + } else { + throw new IOException("Not supported browser"); + } + + response.setHeader("Content-Disposition", dispositionPrefix + encodedFilename); + + if ("Opera".equals(browser)) { + response.setContentType("application/octet-stream;charset=UTF-8"); + } + } + + private String getBrowser(HttpServletRequest request) { + String header = request.getHeader("User-Agent"); + if (header.indexOf("MSIE") > -1) { + return "MSIE"; + } else if (header.indexOf("Trident") > -1) { // IE11 문자열 깨짐 방지 + return "Trident"; + } else if (header.indexOf("Chrome") > -1) { + return "Chrome"; + } else if (header.indexOf("Opera") > -1) { + return "Opera"; + } + return "Firefox"; + } +} diff --git a/src/main/java/com/dbnt/kcgfilemanager/controller/adminController.java b/src/main/java/com/dbnt/kcgfilemanager/controller/adminController.java index 00e72d3..83755ff 100644 --- a/src/main/java/com/dbnt/kcgfilemanager/controller/adminController.java +++ b/src/main/java/com/dbnt/kcgfilemanager/controller/adminController.java @@ -7,8 +7,6 @@ import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; -import java.io.File; -import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; diff --git a/src/main/java/com/dbnt/kcgfilemanager/service/BoardCategoryService.java b/src/main/java/com/dbnt/kcgfilemanager/service/BoardCategoryService.java index 709742d..20e7822 100644 --- a/src/main/java/com/dbnt/kcgfilemanager/service/BoardCategoryService.java +++ b/src/main/java/com/dbnt/kcgfilemanager/service/BoardCategoryService.java @@ -12,6 +12,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.io.File; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -94,9 +95,9 @@ public class BoardCategoryService { public String makeFilePath(Integer categorySeq){ BoardCategory category = boardCategoryRepository.findById(categorySeq).orElse(null); if(category.getParentSeq()==null){ - return "C:\\kcgFileManager\\"+category.getCategoryName(); + return File.separator+category.getCategoryName(); } - return makeFilePath(category.getParentSeq())+"\\"+category.getCategoryName(); + return makeFilePath(category.getParentSeq())+File.separator+category.getCategoryName(); } @Transactional @@ -104,7 +105,6 @@ public class BoardCategoryService { for(BoardCategory category: categoryList){ switch (category.getStatus()){ case "deleted": - /*게시물 삭제 로직 필요.*/ deleteContentToCategorySeq(category.getCategorySeq()); boardCategoryRepository.delete(category); break; diff --git a/src/main/java/com/dbnt/kcgfilemanager/service/BoardService.java b/src/main/java/com/dbnt/kcgfilemanager/service/BoardService.java index d77ef50..5180541 100644 --- a/src/main/java/com/dbnt/kcgfilemanager/service/BoardService.java +++ b/src/main/java/com/dbnt/kcgfilemanager/service/BoardService.java @@ -5,6 +5,7 @@ import com.dbnt.kcgfilemanager.mapper.BoardMapper; import com.dbnt.kcgfilemanager.model.*; import com.dbnt.kcgfilemanager.repository.*; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -30,6 +31,8 @@ public class BoardService { private final HashTagLinkRepository hashTagLinkRepository; private final UserInfoRepository userInfoRepository; + @Value("${spring.servlet.multipart.location}") + private String locationPath; public List fullSearchBoardContent(List categorySeqList, Board board) { board.setRowCnt(Integer.MAX_VALUE); @@ -119,9 +122,9 @@ public class BoardService { int fileSeq = lastFileInfo==null?1:(lastFileInfo.getFileSeq()+1); for(MultipartFile file : content.getFileList()){ String saveName = UUID.randomUUID().toString(); - String path = boardCategoryService.makeFilePath(content.getCategorySeq()); + String path = locationPath+boardCategoryService.makeFilePath(content.getCategorySeq()); - File saveFile = new File(path+"\\"+saveName); + File saveFile = new File(path+File.separator+saveName); if(file.getSize()!=0){ // 저장될 파일 확인 if(!saveFile.exists()){ // 저장될 경로 확인 if(saveFile.getParentFile().mkdirs()){ @@ -139,12 +142,13 @@ public class BoardService { } } - String[] originalFilename = Objects.requireNonNull(file.getOriginalFilename()).split("\\."); + String originalFilename = file.getOriginalFilename(); + int extentionIdx = originalFilename.lastIndexOf("."); FileInfo fileInfo = new FileInfo(); fileInfo.setContentSeq(content.getContentSeq()); fileInfo.setFileSeq(fileSeq++); - fileInfo.setOriginalName(originalFilename[0]); - fileInfo.setExtention(originalFilename[1]); + fileInfo.setOriginalName(originalFilename.substring(0, extentionIdx)); + fileInfo.setExtention(originalFilename.substring(extentionIdx+1)); fileInfo.setConversionName(saveName); fileInfo.setFileSize(calculationSize(file.getSize())); fileInfo.setSavePath(path); @@ -260,7 +264,7 @@ public class BoardService { List fileInfoList = fileInfoRepository.findByContentSeqOrderByFileSeqAsc(contentSeq); for(FileInfo fileInfo: fileInfoList){ if(fileSeqList.contains(fileInfo.getFileSeq())){ - fileInfoService.deleteStoredFile(fileInfo.getSavePath(), fileInfo.getConversionName()); + fileInfoService.deleteStoredFile(new File(fileInfo.getSavePath(), fileInfo.getConversionName())); saveBoardLog(contentSeq, LogStatus.FILE_REMOVE, fileInfo.getFullName(), userId); fileInfoRepository.delete(fileInfo); } @@ -282,8 +286,23 @@ public class BoardService { } public List> getDiskInfoList() { - /*저장공간 확인*/ - File[] drives = File.listRoots(); + /*설정된 경로의 용량 확인*/ + List> diskInfoList = new ArrayList<>(); + File storage = new File(locationPath); + double totalSize = storage.getTotalSpace(); + double useSize = storage.getUsableSpace(); + double freeSize = totalSize - useSize; + + HashMap diskInfo = new HashMap<>(); + diskInfo.put("driveName", storage.getAbsolutePath()); + diskInfo.put("totalSize", calculationSize(totalSize)); + diskInfo.put("useSize", calculationSize(useSize)); + diskInfo.put("freeSize", calculationSize(freeSize)); + diskInfo.put("useSizePer", Math.round(useSize/totalSize*10000)/100d); + diskInfoList.add(diskInfo); + return diskInfoList; + /*전체 저장공간 확인*/ + /*File[] drives = File.listRoots(); List> diskInfoList = new ArrayList<>(); for(File drive : drives) { double totalSize = drive.getTotalSpace(); @@ -298,6 +317,6 @@ public class BoardService { diskInfo.put("useSizePer", Math.round(useSize/totalSize*10000)/100d); diskInfoList.add(diskInfo); } - return diskInfoList; + return diskInfoList;*/ } } diff --git a/src/main/java/com/dbnt/kcgfilemanager/service/FileInfoService.java b/src/main/java/com/dbnt/kcgfilemanager/service/FileInfoService.java index 965f665..df4c213 100644 --- a/src/main/java/com/dbnt/kcgfilemanager/service/FileInfoService.java +++ b/src/main/java/com/dbnt/kcgfilemanager/service/FileInfoService.java @@ -4,6 +4,7 @@ import com.dbnt.kcgfilemanager.config.LogStatus; import com.dbnt.kcgfilemanager.model.FileInfo; import com.dbnt.kcgfilemanager.repository.FileInfoRepository; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.io.File; @@ -17,13 +18,12 @@ public class FileInfoService { public void deleteFileInfoAll(int contentSeq){ List fileInfoList = fileInfoRepository.findByContentSeqOrderByFileSeqAsc(contentSeq); for(FileInfo fileInfo: fileInfoList){ - deleteStoredFile(fileInfo.getSavePath(), fileInfo.getConversionName()); + deleteStoredFile(new File(fileInfo.getSavePath(), fileInfo.getConversionName())); } fileInfoRepository.deleteAll(fileInfoList); } - public void deleteStoredFile(String savePath, String conversionName){ - File deleteFile = new File(savePath, conversionName); + public void deleteStoredFile(File deleteFile){ deleteFile.delete(); } } diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 4f4f2d4..37bb39a 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -1,6 +1,7 @@ spring.devtools.livereload.enabled=true -#file upload size +#file upload +spring.servlet.multipart.location=C:\\kcgFileManager spring.servlet.multipart.max-file-size=200MB spring.servlet.multipart.max-request-size=500MB diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index 4ece5ce..8270073 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -1,5 +1,6 @@ -#file upload size +#file upload +spring.servlet.multipart.location=C:\\kcgFileManager spring.servlet.multipart.max-file-size=200MB spring.servlet.multipart.max-request-size=500MB diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties index d2ff862..85185a1 100644 --- a/src/main/resources/application-test.properties +++ b/src/main/resources/application-test.properties @@ -1,5 +1,6 @@ -#file upload size +#file upload +spring.servlet.multipart.location=/data/kcgFM/files spring.servlet.multipart.max-file-size=200MB spring.servlet.multipart.max-request-size=500MB diff --git a/src/main/resources/static/js/board/contentList.js b/src/main/resources/static/js/board/contentList.js index 9caee70..5808715 100644 --- a/src/main/resources/static/js/board/contentList.js +++ b/src/main/resources/static/js/board/contentList.js @@ -44,7 +44,7 @@ $(document).on('click', '#logTab', function (){ }) $(document).on('click', '.fileDownLink', function (){ - let url = "/board/fileDownload?" + let url = "/file/fileDownload?" url += "contentSeq="+Number($("#detailViewContentSeq").val()); url += "&fileSeq="+$(this).attr("data-fileseq"); window.open(encodeURI(url)); @@ -53,7 +53,7 @@ $(document).on('click', '.fileDownLink', function (){ $(document).on('click', '#zipDownBtn', function (){ const checkFiles = $(".fileCheckBox:checked"); if(checkFiles.length>0){ - let url = "/board/fileDownloadToZip?" + let url = "/file/fileDownloadToZip?" url += "contentSeq="+Number($("#detailViewContentSeq").val()); checkFiles.each(function (idx, el){ url += "&fileSeq="+Number($(el).attr("data-fileseq"))