새로 만든 페이지에 이미지 파일 첨부 기능 질문

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
새로 만든 페이지에 이미지 파일 첨부 기능 질문

QA

새로 만든 페이지에 이미지 파일 첨부 기능 질문

본문

write.skin.php에 있는 파일 첨부 부분을 이용해서 새 페이지에 해당 기능을 사용하려고 하는데

단순하게 파일 첨부 입력폼과 첨부파일(이미지)을 뿌려주는 코드만으로 안되더라구요

 

새 페이지에 적용해야되기 때문에 파일 관련 db를 사용해야되는데 엄청 복잡해지네요 ㅜㅜ

 


    <?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
    <div class="bo_w_flie write_div_file">
        <div class="file_wr write_div_file">
            <label for="bf_file_<?php echo $i+1 ?>" class="lb_icon"><i class="fa fa-folder-open" aria-hidden="true"></i><span class="sound_only"> 파일 #<?php echo $i+1 ?></span></label>
            <input type="file" name="bf_file[]" id="bf_file_<?php echo $i+1 ?>" title="파일첨부 <?php echo $i+1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file imgext">
        </div>
        <?php if ($is_file_content) { ?>
        <input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content'] : ''; ?>" title="파일 설명을 입력해주세요." class="full_input frm_input" size="50" placeholder="파일 설명을 입력해주세요.">
        <?php } ?>
        <?php if($w == 'u' && $file[$i]['file']) { ?>
        <span class="file_del">
            <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>
        </span>
        <?php } ?>
        
    </div>
    <?php } ?>

일단, write.skin.php에 있는 부분인데 이걸 따와서

 


        <div class="bo_w_flie write_div" style="margin-bottom:50px;">
            <div class="file_wr write_div">
                <input type="file" name="bf_file[]" id="bf_file_1" title="파일첨부 1 : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file imgext" style="float:right;">
            </div>
            <?php if ($is_file_content) { ?>
            <input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[0]['bf_content'] : ''; ?>" title="파일 설명을 입력해주세요." class="full_input frm_input" size="50" placeholder="파일 설명을 입력해주세요.">
            <?php } ?>
            <?php if($w == 'u' && $file[0]['file']) { ?>
            <span class="file_del">
                <input type="checkbox" id="bf_file_del0" name="bf_file_del[0]" value="1"> <label for="bf_file_del0"><?php echo $file[0]['source'].'('.$file[0]['size'].')';  ?> 파일 삭제</label>
            </span>
            <?php } ?>
        </div>

요런식으로 바꿔줬습니다... 파일 첨부 입력폼은 잘뜨더라구요

 

db에 파일 정보를 저장해야되는데 도무지 어떻게 해야될지 모르겠습니다...

이 질문에 댓글 쓰기 :

답변 1

php 파일 업로드하는 부분부터 보세요.

https://zetawiki.com/wiki/PHP_%ED%8C%8C%EC%9D%BC_%EC%97%85%EB%A1%9C%EB%93%9C_%EA%B5%AC%ED%98%84

 

업로드 완료 부분에 DB 삽입하면 됩니다.

 

 

g5_board_file 처럼 db를 만들어야될거 같은데 맞나요? 맞다면 새로 만들 g5_board_file 테이블의 필드값을 어떻게 해야될까요? 그리고 그 페이지의 update.php에서 데이터를 어떻게 저장해야될까요...
감을 못잡겠어서 ㅜㅜ

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

회원로그인

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