75 lines
2.4 KiB
Plaintext
75 lines
2.4 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
|
|
<%@ page import="java.util.*, java.io.*" %>
|
|
<%@include file= "/init.jsp" %>
|
|
<%
|
|
|
|
HashMap map = (HashMap)request.getAttribute("FILE_MAP");
|
|
if(map == null) map = new HashMap();
|
|
|
|
String objId = CommonUtils.checkNull(map.get("OBJID"));
|
|
String targetObjId = CommonUtils.checkNull(map.get("TARGET_OBJID"));
|
|
String savedFileName = CommonUtils.checkNull(map.get("SAVED_FILE_NAME"));
|
|
String realFileName = CommonUtils.checkNull(map.get("REAL_FILE_NAME"));
|
|
String docType = CommonUtils.checkNull(map.get("DOC_TYPE"));
|
|
String docTypeName = CommonUtils.checkNull(map.get("DOC_TYPE_NAME"));
|
|
String fileSize = CommonUtils.checkNull(map.get("FILE_SIZE"));
|
|
String fileExt = CommonUtils.checkNull(map.get("FILE_EXT"));
|
|
String filePath = CommonUtils.checkNull(map.get("FILE_PATH"));
|
|
|
|
if(!"".equals(realFileName)){
|
|
realFileName = (java.net.URLEncoder.encode(realFileName, "UTF-8")).replaceAll("\\+", " ");
|
|
}
|
|
|
|
String fullFilePath = filePath+"\\"+savedFileName;
|
|
System.out.println("ppt fullFilePath : "+fullFilePath);
|
|
|
|
File f = new File(fullFilePath);
|
|
if(f.exists()){
|
|
|
|
int filesize = (int)f.length();
|
|
byte buff[] = new byte[2048];
|
|
int bytesRead;
|
|
|
|
try {
|
|
out.clear();
|
|
out=pageContext.pushBody();
|
|
|
|
//response.setContentType("text/plain; charset=EUC_KR");
|
|
//response.setContentType("application/x-msdownload");
|
|
response.setContentType("application/vnd.ms-powerpoint");
|
|
response.setHeader("Content-Disposition", "attachment; filename="+ realFileName);
|
|
FileInputStream fin = new java.io.FileInputStream(f);
|
|
BufferedInputStream bis = new BufferedInputStream(fin);
|
|
ServletOutputStream fout = response.getOutputStream();
|
|
BufferedOutputStream bos = new BufferedOutputStream(fout);
|
|
|
|
while((bytesRead = bis.read(buff)) != -1) {
|
|
bos.write(buff, 0, bytesRead);
|
|
}
|
|
bos.flush();
|
|
|
|
fin.close();
|
|
fout.close();
|
|
bis.close();
|
|
bos.close();
|
|
|
|
//file download log 2015-12-22 jmpark start
|
|
Map paramMap = new HashMap();
|
|
paramMap.put("savedFileName", savedFileName);
|
|
paramMap.put("realFileName", realFileName);
|
|
paramMap.put("fileExt", fileExt);
|
|
|
|
//file download log 2015-12-22 jmpark end
|
|
|
|
} catch( IOException e){
|
|
response.setContentType("text/html; charset=EUC_KR");
|
|
out.println("Error : "+e.getMessage());
|
|
}
|
|
}else{
|
|
response.setContentType("text/html; charset=EUC_KR");
|
|
out.println("File Not Found : " + fullFilePath);
|
|
}
|
|
|
|
|
|
%>
|