채택완료

첨부 파일 저장 주소

업로드된 파일명이 지정된 변수를 알 수 있을까요?

아니면 변수를 지정하고 있는 곳은 어디인지.

 

첨부 파일 경로명에 태그를 씌워 활용하려고 합니다.

 

예를 들면

 

<video src="첨부파일 경로명">

<img src="첨부파일 경로명">

 

이 때 경로에

 

<?=view[file][0][href]?>

를 넣으면 첫번째 첨부파일 경로명으로 설정되는 것으로 파악했으나

 

해당 경로명은 

 

download.php?로 시작하는 주소로

파일 경로가 명확하지 않으며 다운로드 권한이 없는 경우 확인이 불가능한 단점을 확인했습니다.

 

따라서 첨부파일 경로명을

(그누보드설치경로)/data/file/$bo_table/이하 복잡하게 변경된 파일명

 

으로 설정하고자 하는데 복잡하게 변경된 파일명의 변수를 찾지 못해 사용하지 못하고 있습니다.

 

알려주시면 정말 감사하겠습니다.

 

 

오늘 오전 11시 부터 지금 밤 12시가 되도록 헤매고 있습니다...

|

답변 2개 / 댓글 1개

채택된 답변
+20 포인트

뷰스킨에서는

첨부화일명은 $view[file][0][file], $view[file][1][file]~~~ 이런 변수에 들어있습니다

 print_r($view) 해보면 모든 변수와 값이 주루룩 나옵니다

 

답변에 대한 댓글 1개

정말 정말 감사합니다!

common 파일에 있는것을 확인하였으나 여전히 정확한 파일명 변수를 모르겠습니다.

 

Copy
// 게시글에 첨부된 파일을 얻는다. (배열로 반환)function get_file($bo_table, $wr_id){    global $g5, $qstr;    $file['count'] = 0;    $sql = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no ";    $result = sql_query($sql);    while ($row = sql_fetch_array($result))    {        $no = $row['bf_no'];        $file[$no]['href'] = G5_BBS_URL."/download.php?bo_table=$bo_table&amp;wr_id=$wr_id&amp;no=$no" . $qstr;        $file[$no]['download'] = $row['bf_download'];        // 4.00.11 - 파일 path 추가        $file[$no]['path'] = G5_DATA_URL.'/file/'.$bo_table;        $file[$no]['size'] = get_filesize($row['bf_filesize']);        $file[$no]['datetime'] = $row['bf_datetime'];        $file[$no]['source'] = addslashes($row['bf_source']);        $file[$no]['bf_content'] = $row['bf_content'];        $file[$no]['content'] = get_text($row['bf_content']);        //$file[$no]['view'] = view_file_link($row['bf_file'], $file[$no]['content']);        $file[$no]['view'] = view_file_link($row['bf_file'], $row['bf_width'], $row['bf_height'], $file[$no]['content']);        $file[$no]['file'] = $row['bf_file'];        $file[$no]['image_width'] = $row['bf_width'] ? $row['bf_width'] : 640;        $file[$no]['image_height'] = $row['bf_height'] ? $row['bf_height'] : 480;        $file[$no]['image_type'] = $row['bf_type'];        $file['count']++;    }    return $file;}

 

Copy
// 파일명 치환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;}

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