채택완료

한글다운로드시 파일명이 깨져서 나옵니다.

2016-06-02 (목) 16:34:05 6,685

안녕하세요.

그누보드 다운로드 파일을 참고하여 다운로드를 구현했는데

이미지 파일이 한글일시에 다운로드가 한글이 깨져서나옵니다..

bbs/download.php 파일을 보고 만들었는데.. 어디부분에서 한글이깨지는지모르겠네요..

DB와 출력시에는 한글이 잘 표현됩니다.

10208a7c3fde8f39eed55578a40b5e23_1464852827_0644.jpg
 

Copy
<?phpinclude_once('./_common.php'); $order = sql_real_escape_string($_GET['order']);$cart = sql_real_escape_string($_GET['cart']);$no = sql_real_escape_string($_GET['no']);$no = (int)$no;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.'&amp;cart='.$cart.'&amp;sf_no='.$no));}$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' ";$file = sql_fetch($sql);if (!$file['sf_file'])    alert_close('파일 정보가 존재하지 않습니다.');$ym = substr(str_replace('-', '', $file['sf_datetime']), 2, 4);$filepath = G5_DATA_PATH.'/odattach/'.$ym.'/'.$file['sf_file'];$filepath = addslashes($filepath);if (!is_file($filepath) || !file_exists($filepath))    alert('파일이 존재하지 않습니다.');$g5['title'] = '다운로드 &gt; '.conv_subject($file['sf_source'], 255);$original = (preg_match("/msie/i", $_SERVER['HTTP_USER_AGENT'])) ? urlencode($file['sf_source']) : $file['sf_source'];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();$fp = fopen($filepath, 'rb');$download_rate = 10;while(!feof($fp)) {    print fread($fp, round($download_rate * 1024));    flush();    usleep(1000);}fclose ($fp);flush();?>
|

답변 1개 / 댓글 1개

채택된 답변
+20 포인트

69ef67727c7cda96849c4fcdc65bf3d8_1464860247_9094.png팡파일을 수정 하거 나 할때 인코딩 방식이 틀릴 겨우 방생 할수있습니다
파 

답변에 대한 댓글 1개

해결하였습니다.
iconv 로 인코딩을 다시 해주었습니다. 감사합니다.

답변을 작성하려면 로그인이 필요합니다.