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,429
7년 전 조회 5,135
7년 전 조회 2,417
7년 전 조회 3,182
8년 전 조회 3,449
8년 전 조회 7,234
8년 전 조회 4,996
8년 전 조회 4,481
8년 전 조회 3,678
8년 전 조회 3,620
9년 전 조회 3,101
9년 전 조회 3,459
9년 전 조회 5,157
9년 전 조회 4,834
9년 전 조회 5,030
9년 전 조회 5,240
9년 전 조회 5,276
9년 전 조회 4,623
9년 전 조회 5,148
10년 전 조회 7,308
🐛 버그신고