첨부파일 설명 하나더

첨부파일 설명 하나더

QA

첨부파일 설명 하나더

본문

첨부파일 설명 보이기후 

 

write_update.php에서 

 

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

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

 

이런식으로 추가하고 

 

db필드도 추가했습니다. 

 

그리고 

 

write.skkin.php에서 

아래와 같이 사용중입니다. 

 



 
<?php for ($i=0; $is_file && $i<=$file['count'];$i++) { ?>
                    <div class="addpic">
                        
                        <?php if($w == 'u' && $file[$i]['file']) { ?>
                        <div class="pic">
                        <!--첨부사진 보이기/-->
                        <?php
                        $file = get_file($bo_table, $wr_id);
                        $image = urlencode($file[$i]['file']);
                        $image_path = G5_DATA_PATH.'/file/'.$bo_table;
                        $image_url = G5_DATA_URL.'/file/'.$bo_table;
                        if (preg_match("/\.(gif|jpg|jpeg|png)$/i", $image)) {
                            $thumb = thumbnail($image, $image_path , $image_path , 100, 100, false, true);
                            $image_content = $image_url.'/'.$thumb;
                            echo "<img src=".$image_content.">";
                        }
                          ?>
                        </div>
                        <div class="txt">
                            <input type="file" name="bf_file[]" title="사진첨부 <?php echo $i+1 ?> :  용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file frm_input file" style="display:inline-block;">
                            <input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content'] : ''; ?>" title="사진 설명을 입력해주세요." class="frm_file_content frm_input explain">
                            <input type="text" name="bf_content2[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content2'] : ''; ?>" title="사진 설명을 입력해주세요." class="frm_file_content frm_input explain">
                            <input type="checkbox" id="bf_file_del<?php echo $i ?>" name="bf_file_del[<?php echo $i;  ?>]" value="1"> <label for="bf_file_del<?php echo $i ?>"><?php echo $file[$i]['source'].'('.$file[$i]['size'].')';  ?> 사진 삭제</label>
                        </div>
                        <!--/첨부사진 보이기-->
                        <?php } ?>
                        
                        
                        
                        
                        
                    </div>
                    
                    <?php if ($i==0) { ?>
                        <button type="button" class="btn_frmline fwzadd addpic">사진추가</button>
                        <?php } ?>
                    <?php } ?>

 

input에 값넣고 글쓰기시 DB에 값 저장은 잘되는데 

수정시에는

bf_content[] 값만 불러와지고

bf_content2[] 값은 안불러와지는데

왜 그럴까요? 

이 질문에 댓글 쓰기 :

답변 2

for문 언의 get_file을 삭제하세요

저렇게 for문 내에서 이미지 하나 출력할때마다 매번 불러오는 것이 아닙니다

 

lib/common.lib.php --> get-file 함수를 수정만 하면 됩니다

 

$bf_content = ~~다음행에 동일한 방법으로 bf_content2 추가

$bf_content2 = $row['bf_content2'] ? html_purifier($row['bf_content2']) : '';

 

$file[$no]['content'] = get_text($bf_content); <--- 다음행에 추가

$file[$no]['content2'] = get_text($bf_content2);

 

그리고 질문 코드처럼 $file[$i][bf_content] 하지말고 $file[$i]['content'] , $file[$i]['content2'] 사용

====================

이런 문제가 생길때마다 get_file을 어디서 불러오는지 get_file함수가 어떻게 생겼는지 소스를 찾아보세요

저 소스를 보면 이렇게 추가하면 되겠구나하고 알게 될 것입니다

그렇게 해야 그누보드 사용법을 익히게 되고 실력이 늘지 이렇게 답변만으로 해결하면

10년이 지나도 그누보드 제대로 사용 못합니다

 

 

 

$file

을 lib/common.lib.php의  get_file()을 이용해서 가져 오는 것이라면

get_file() 함수 안에서

 

        $file[$no]['bf_content'] = $bf_content;
이런 부분도 추가해 주어야 합니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 123,529 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT