사이트 내 전체검색
그누보드
검색목록
[팁] 한글 파일명을 그대로 저장하는 방법
로빈아빠
https://cmd.kr/gnu/452 URL이 복사되었습니다.

본문

1. write_update.php 에서..
$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode(str_replace(' ', '_', $filename))); 

---> 이것을 다음과 같이 변경
if ($g4[charset]=="utf-8") { //utf-8인경우
//utf-8 서버인경우
//$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', iconv("UTF-8","EUC-KR",str_replace(' ', '_', $filename))); 
//윈도우즈 서버 또는 euc-kr 서버인경우
$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', str_replace(' ', '_', $filename)); 
}
else {
//utf-8 서버인경우
$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', iconv("EUC-KR","UTF-8",str_replace(' ', '_', $filename))); 
//윈도우즈 서버 또는 euc-kr 서버인경우
//$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', str_replace(' ', '_', $filename)); 
}



2. download.php 에서

$filepath = "$g4[path]/data/file/$bo_table/$file[bf_file]";
$filepath = addslashes($filepath);

if (!is_file($filepath)) {
$filepath = "$g4[path]/data/file/$bo_table/".iconv("EUC-KR","UTF-8",$file[bf_file]);
$filepath = addslashes($filepath);

if (!is_file($filepath)) {
$filepath = "$g4[path]/data/file/$bo_table/".iconv("UTF-8","EUC-KR",$file[bf_file]);
$filepath = addslashes($filepath);
}
}

if (!is_file($filepath) || !file_exists($filepath)) {
    alert("파일이 존재하지 않습니다.");
}

---> 해보니 결론은 꽝이다..
다른 스킨등에서 파일다운로드를 직접하는경우 문제가된다.. 일일이 다 바꾸어주지 않는이상 힘들다.

댓글목록

등록된 댓글이 없습니다.

그누보드
65 (1/2P)

Search

Copyright © Cmd 명령어 18.226.187.24