업로드 다운로드 관련 질문입니다. 정보
업로드 다운로드 관련 질문입니다.본문
우선 매번 답변주시는 분들께 깊은 감사를 드립니다 ㅠㅠ;;
제가 허접하기에;; 답변주시는 분들이 고생인듯;;;
본론으로 들어가서..
예를들어 aaa.alz 파일이 있으면 게시판에 업로드 시 aaa_년_월_일.alz로 변경되고
다운로드시 다시 aaa.alz로 변경되게 하려면
어디를 어떤식으로 고쳐야 되는지만 이라도 알려주시면 감사하겠습니다.
더 많이 알려주면.. 당연히 좋겠지만..ㅋㅋㅋ 팁란을 계속 찾아봐도.. 잘 모르겠군요 ㅠㅠ;
댓글 전체
업로드시 : bbs/write_update.php 참조
// 프로그램 원래 파일명
$upload[$i][source] = $filename;
$upload[$i][filesize] = $filesize;
// 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함
$filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename);
// 접미사를 붙인 파일명
//$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr(md5(uniqid($g4[server_time])),0,8).'_'.urlencode($filename);
// 달빛온도님 수정 : 한글파일은 urlencode($filename) 처리를 할경우 '%'를 붙여주게 되는데 '%'표시는 미디어플레이어가 인식을 못하기 때문에 재생이 안됩니다. 그래서 변경한 파일명에서 '%'부분을 빼주면 해결됩니다.
$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr(md5(uniqid($g4[server_time])),0,8).'_'.str_replace('%', '', urlencode($filename));
$dest_file = "$g4[path]/data/file/$bo_table/" . $upload[$i][file];
// 업로드가 안된다면 에러메세지 출력하고 죽어버립니다.
$error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES[bf_file][error][$i]);
// 올라간 파일의 퍼미션을 변경합니다.
chmod($dest_file, 0606);
다운로드시는 bbs/download.php에서
($upload[$i][source] = $filename; bbs/write_update.php에서 원 화일명 저장.....)
원래 저장된 화일명으로 처리...
$filepath = "$g4[path]/data/file/$bo_table/$file[bf_file]";
$filepath = addslashes($filepath);
if (preg_match("/^utf/i", $g4[charset]))
$original = urlencode($file[bf_source]);
else
$original = $file[bf_source];
// 프로그램 원래 파일명
$upload[$i][source] = $filename;
$upload[$i][filesize] = $filesize;
// 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함
$filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename);
// 접미사를 붙인 파일명
//$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr(md5(uniqid($g4[server_time])),0,8).'_'.urlencode($filename);
// 달빛온도님 수정 : 한글파일은 urlencode($filename) 처리를 할경우 '%'를 붙여주게 되는데 '%'표시는 미디어플레이어가 인식을 못하기 때문에 재생이 안됩니다. 그래서 변경한 파일명에서 '%'부분을 빼주면 해결됩니다.
$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr(md5(uniqid($g4[server_time])),0,8).'_'.str_replace('%', '', urlencode($filename));
$dest_file = "$g4[path]/data/file/$bo_table/" . $upload[$i][file];
// 업로드가 안된다면 에러메세지 출력하고 죽어버립니다.
$error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES[bf_file][error][$i]);
// 올라간 파일의 퍼미션을 변경합니다.
chmod($dest_file, 0606);
다운로드시는 bbs/download.php에서
($upload[$i][source] = $filename; bbs/write_update.php에서 원 화일명 저장.....)
원래 저장된 화일명으로 처리...
$filepath = "$g4[path]/data/file/$bo_table/$file[bf_file]";
$filepath = addslashes($filepath);
if (preg_match("/^utf/i", $g4[charset]))
$original = urlencode($file[bf_source]);
else
$original = $file[bf_source];