hwp 한글파일 다운로드시 깨짐 문제 해결과 다운로드명 그대로 나오게 하기

그누커머스 게시판에서 hwp 한글파일을 첨부후 다운로드 받을 때 깨지거나 이름이 변경되어 보이는 경우가 있습니다. 이 문제는 아래와 같이 해결할 수 있으니 필요하신 분들 참고하시기 바랍니다.

 

==============================

/gnucommerce/bbs/download.php

==============================

 

아래 문구로 검색하여 소스 교체합니다.
if(preg_match("/msie/i

교체할 소스
if(preg_match("/msie/i  부터  flush();  까지 아래 소스로 교체...
------------------------------------------------


if(preg_match("/msie/i", $_SERVER['HTTP_USER_AGENT']) && preg_match("/5\.5/", $_SERVER['HTTP_USER_AGENT'])) {
    header("content-type: doesn/matter");
    header("content-length: ".filesize("$filepath"));
    header("content-disposition: attachment; filename=\"$original\"");
    header("content-transfer-encoding: binary");
} else if (preg_match("/Firefox/i", $_SERVER['HTTP_USER_AGENT'])){
    header("content-type: file/unknown");
    header("content-length: ".filesize("$filepath"));
    header("content-disposition: attachment; filename=\"".basename($file['bf_source'])."\"");
    header("content-description: php generated data");
} else {
    header("content-type: file/unknown");
    header("content-length: ".filesize("$filepath"));
    header("content-disposition: attachment; filename=\"$original\"");
    header("content-description: php generated data");
}
header("pragma: no-cache");
header("expires: 0");
ob_clean();
flush();

 

|

댓글 2개

좋은 팁 감사 합니다.

파일 깨지는 문제 해결했습니다. 감사합니다.

댓글을 작성하시려면 로그인이 필요합니다.

그누커머스 팁자료실

그누커머스와 관련된 팁을 여러분들과 함께 공유하세요. 나누면 즐거움이 커집니다.

+
제목 글쓴이 날짜 조회
6년 전 조회 2,478
7년 전 조회 5,181
7년 전 조회 2,456
7년 전 조회 3,223
8년 전 조회 3,492
8년 전 조회 7,292
8년 전 조회 5,036
8년 전 조회 4,525
9년 전 조회 3,730
9년 전 조회 3,672
9년 전 조회 3,147
9년 전 조회 3,502
9년 전 조회 5,211
10년 전 조회 4,875
10년 전 조회 5,094
10년 전 조회 5,283
10년 전 조회 5,316
10년 전 조회 4,701
10년 전 조회 5,217
10년 전 조회 7,366