가이드데로 코딩했는데 한글파일 다운로드시 한글파일명이 깨지네요.
- 작성자 :
- 김*순
- 작성일 :
- 2009-11-25 11:27:57
- 조회수 :
- 4,554
- 구분 :
- 실행환경
- 진행상태 :
- 완료
Q
가이드에 있는데로 코딩했는데 한글파일 다운로드시 한글파일명이 깨지네요.
뭐가 빠졌을까요 ..............................
@RequestMapping(value = "/download/downloadFile.do")
public void downloadFile(HttpServletResponse response) throws Exception {
String uploadPath = propertiesService.getString("fileUploadPath");
String requestedFile = "한글샘플파일.txt";
File uFile = new File(uploadPath, requestedFile);
int fSize = (int) uFile.length();
BufferedInputStream in = new BufferedInputStream(new FileInputStream(uFile));
String mimetype = "text/html";
response.setBufferSize(fSize);
response.setContentType(mimetype);
response.setHeader("Content-Disposition", "attachment; filename=\"" + requestedFile + "\"");
response.setContentLength(fSize);
FileCopyUtils.copy(in, response.getOutputStream());
in.close();
response.getOutputStream().flush();
response.getOutputStream().close();
}
뭐가 빠졌을까요 ..............................
@RequestMapping(value = "/download/downloadFile.do")
public void downloadFile(HttpServletResponse response) throws Exception {
String uploadPath = propertiesService.getString("fileUploadPath");
String requestedFile = "한글샘플파일.txt";
File uFile = new File(uploadPath, requestedFile);
int fSize = (int) uFile.length();
BufferedInputStream in = new BufferedInputStream(new FileInputStream(uFile));
String mimetype = "text/html";
response.setBufferSize(fSize);
response.setContentType(mimetype);
response.setHeader("Content-Disposition", "attachment; filename=\"" + requestedFile + "\"");
response.setContentLength(fSize);
FileCopyUtils.copy(in, response.getOutputStream());
in.close();
response.getOutputStream().flush();
response.getOutputStream().close();
}
A
안녕하세요.. 김희순님..
다운로드시 한글처리는 WAS 환경 및 Client 브라우저에 따라 처리 방식이 복잡하게 처리되어야 합니다.
구체적인 한글 처리를 참조하시려면..
공통컴포넌트의 요소기술 중 "파일다운로드" 부분의 소스를 받으셔서 참조하셔야 할 것 같습니다.
- 파일명 : egovframework-common-1.0.0.zip
- 참조 소스 : src/main/java/egovframework/com/cmm/web/EgovFileDownloadController.java
그럼.. 즐거운 하루 되십시오.
감사합니다.
다운로드시 한글처리는 WAS 환경 및 Client 브라우저에 따라 처리 방식이 복잡하게 처리되어야 합니다.
구체적인 한글 처리를 참조하시려면..
공통컴포넌트의 요소기술 중 "파일다운로드" 부분의 소스를 받으셔서 참조하셔야 할 것 같습니다.
- 파일명 : egovframework-common-1.0.0.zip
- 참조 소스 : src/main/java/egovframework/com/cmm/web/EgovFileDownloadController.java
그럼.. 즐거운 하루 되십시오.
감사합니다.