파일업로드 카운드 채택완료

4년 전 조회 1,527

게시판의 파일업로드가 안됩니다.

write_update.php 를 살펴 봤는데요.

Copy
$row = sql_fetch(" select count(*) as cnt from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' ");

sql_query(" update {$write_table} set wr_file = '{$row['cnt']}' where wr_id = '{$wr_id}' ");

이 부분에서 파일의 개수를 업로드 하는데요. 파일 선택 후 등록을 하면 파일은 이동되서 파일질라에서 확인이 되지만 게시글에서는 확인이 안됩니다.

따로 오류가 발생하지 않아서 원은을 파악하기 힘드네요.

퍼미션도 707로 맞춰져 있습니다.

답변 1개

채택된 답변
+20 포인트

write_update.php 원본을 다운받아서 올려보세요..

파일 업로드 후 저장되는 부분의 문제 입니다.

Copy
// 나중에 테이블에 저장하는 이유는 $wr_id 값을 저장해야 하기 때문입니다.

for ($i=0; $i<count($upload); $i++)

{

    $upload[$i]['source'] = sql_real_escape_string($upload[$i]['source']);

    $bf_content[$i] = isset($bf_content[$i]) ? sql_real_escape_string($bf_content[$i]) : '';

    $bf_width = isset($upload[$i]['image'][0]) ? (int) $upload[$i]['image'][0] : 0;

    $bf_height = isset($upload[$i]['image'][1]) ? (int) $upload[$i]['image'][1] : 0;

    $bf_type = isset($upload[$i]['image'][2]) ? (int) $upload[$i]['image'][2] : 0;

 

    $row = sql_fetch(" select count(*) as cnt from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");

    if ($row['cnt'])

    {

        // 삭제에 체크가 있거나 파일이 있다면 업데이트를 합니다.

        // 그렇지 않다면 내용만 업데이트 합니다.

        if ($upload[$i]['del_check'] || $upload[$i]['file'])

        {

            $sql = " update {$g5['board_file_table']}

                        set bf_source = '{$upload[$i]['source']}',

                             bf_file = '{$upload[$i]['file']}',

                             bf_content = '{$bf_content[$i]}',

                             bf_fileurl = '{$upload[$i]['fileurl']}',

                             bf_thumburl = '{$upload[$i]['thumburl']}',

                             bf_storage = '{$upload[$i]['storage']}',

                             bf_filesize = '".(int)$upload[$i]['filesize']."',

                             bf_width = '".$bf_width."',

                             bf_height = '".$bf_height."',

                             bf_type = '".$bf_type."',

                             bf_datetime = '".G5_TIME_YMDHIS."'

                      where bo_table = '{$bo_table}'

                                and wr_id = '{$wr_id}'

                                and bf_no = '{$i}' ";

            sql_query($sql);

        }

        else

        {

            $sql = " update {$g5['board_file_table']}

                        set bf_content = '{$bf_content[$i]}'

                        where bo_table = '{$bo_table}'

                                  and wr_id = '{$wr_id}'

                                  and bf_no = '{$i}' ";

            sql_query($sql);

        }

    }

    else

    {

        $sql = " insert into {$g5['board_file_table']}

                    set bo_table = '{$bo_table}',

                         wr_id = '{$wr_id}',

                         bf_no = '{$i}',

                         bf_source = '{$upload[$i]['source']}',

                         bf_file = '{$upload[$i]['file']}',

                         bf_content = '{$bf_content[$i]}',

                         bf_fileurl = '{$upload[$i]['fileurl']}',

                         bf_thumburl = '{$upload[$i]['thumburl']}',

                         bf_storage = '{$upload[$i]['storage']}',

                         bf_download = 0,

                         bf_filesize = '".(int)$upload[$i]['filesize']."',

                         bf_width = '".$bf_width."',

                         bf_height = '".$bf_height."',

                         bf_type = '".$bf_type."',

                         bf_datetime = '".G5_TIME_YMDHIS."' ";

        sql_query($sql);

 

        run_event('write_update_file_insert', $bo_table, $wr_id, $upload[$i], $w);

    }

}
로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

답변 감사합니다.
자체 해결 했습니다. 감사합니다.

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

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

로그인
🐛 버그신고