한글다운로드시 파일명이 깨져서 나옵니다. 채택완료
안녕하세요.
그누보드 다운로드 파일을 참고하여 다운로드를 구현했는데
이미지 파일이 한글일시에 다운로드가 한글이 깨져서나옵니다..
bbs/download.php 파일을 보고 만들었는데.. 어디부분에서 한글이깨지는지모르겠네요..
DB와 출력시에는 한글이 잘 표현됩니다.

</p><p><?php
include_once('./_common.php');</p><p> </p><p>$order = sql_real_escape_string($_GET['order']);
$cart = sql_real_escape_string($_GET['cart']);
$no = sql_real_escape_string($_GET['no']);</p><p>$no = (int)$no;</p><p>if (!$is_admin) {
$alert_msg = '\\n\\n다운로드 권한이 없습니다.\\n\\n관리자로 로그인 후 다시 시도해주십시오.\\n\\n';
alert($alert_msg, G5_BBS_URL.'/login.php?url='.urlencode(G5_SHOP_URL.'/attach_download.php?order='.$order.'&cart='.$cart.'&sf_no='.$no));
}</p><p>$sql = " select sf_source, sf_file, sf_datetime from {$g5['g5_shop_attach_file']} where od_id = '$order' and ct_id = '$cart' and sf_no = '$no' ";</p><p>$file = sql_fetch($sql);</p><p>if (!$file['sf_file'])
alert_close('파일 정보가 존재하지 않습니다.');</p><p>$ym = substr(str_replace('-', '', $file['sf_datetime']), 2, 4);
$filepath = G5_DATA_PATH.'/odattach/'.$ym.'/'.$file['sf_file'];
$filepath = addslashes($filepath);</p><p>if (!is_file($filepath) || !file_exists($filepath))
alert('파일이 존재하지 않습니다.');</p><p>$g5['title'] = '다운로드 > '.conv_subject($file['sf_source'], 255);</p><p>$original = (preg_match("/msie/i", $_SERVER['HTTP_USER_AGENT'])) ? urlencode($file['sf_source']) : $file['sf_source'];</p><p>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 {
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");
flush();</p><p>$fp = fopen($filepath, 'rb');</p><p>$download_rate = 10;</p><p>while(!feof($fp)) {
print fread($fp, round($download_rate * 1024));
flush();
usleep(1000);
}
fclose ($fp);
flush();
?> </p><p>
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
답변에 대한 댓글 1개
�
9년 전
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인전체 질문 목록
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
채택
답변대기
답변대기
답변대기
답변대기
채택
채택
답변대기
답변대기
답변대기
채택
팡파일을 수정 하거 나 할때 인코딩 방식이 틀릴 겨우 방생 할수있습니다
iconv 로 인코딩을 다시 해주었습니다. 감사합니다.