Posts

Showing posts with the label ZIPFILE

[JAVA] Compress and download only the files selected in the view group with ALZip

Image
@RequestMapping(value = "/fileAllDownload") protected void finalfileAllDownload(HttpServletRequest request, HttpServletResponse response, HttpSession session, FileVO fileVO) throws IOException{ List<FileVO> getList = fileService.finalReportAll(fileVO); String[] files = new String[getList.size()]; String[] filesOrg = new String[getList.size()]; Long filesActSum = new Long(0); for(int i = 0; i<getList.size(); i++) { files[i] = getList.get(i).getFileName1()+"."+getList.get(i).getExt(); files[i] = getList.get(i).getFileName2(); filesOrg[i] = getList.get(i).getFileName3(); filesActSum += getList.get(i).getFileSize4(); } int actSize=Math.toIntExact(filesActSum);  ZipOutputStream zout = null;  String zipName = "finalReportAll.zip"; //ZIP file name String tempPath = "";  if (files.length > 0) {  try{ tempPath = "/temp/"; //ZIP file save route tempPath = request.getSession().getServletContext().getRealPath("/") + "upl...