Skip to content

Commit

Permalink
업로드 파일명 코드 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
chicpro committed Nov 11, 2015
1 parent be15f89 commit 69ca119
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bbs/qawrite_update.php
Expand Up @@ -187,7 +187,7 @@
$shuffle = implode('', $chars_array);

// 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925)
$upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode(str_replace(' ', '_', $filename)));
$upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.replace_filename($filename);

$dest_file = G5_DATA_PATH.'/qa/'.$upload[$i]['file'];

Expand Down
2 changes: 1 addition & 1 deletion bbs/write_update.php
Expand Up @@ -485,7 +485,7 @@
$shuffle = implode('', $chars_array);

// 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925)
$upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode(str_replace(' ', '_', $filename)));
$upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.replace_filename($filename);

$dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$upload[$i]['file'];

Expand Down
11 changes: 11 additions & 0 deletions lib/common.lib.php
Expand Up @@ -2914,6 +2914,17 @@ function get_safe_filename($name)
return $name;
}

// 파일명 치환
function replace_filename($name)
{
@session_start();
$ss_id = session_id();
$usec = get_microtime();
$ext = array_pop(explode('.', $name));

return sha1($ss_id.$_SERVER['REMOTE_ADDR'].$usec).'.'.$ext;
}

// 아이코드 사용자정보
function get_icode_userinfo($id, $pass)
{
Expand Down

0 comments on commit 69ca119

Please sign in to comment.