폼메일에서 첨부파일 항목 집어 넣는 방법에 대해 궁금합니다.

폼메일에서 첨부파일 항목 집어 넣는 방법에 대해 궁금합니다.

QA

폼메일에서 첨부파일 항목 집어 넣는 방법에 대해 궁금합니다.

답변 1

본문

아래 '파일 첨부 항목'이 빠져있는 폼메일 글쓰기 페이지 소스에서

파일첨부 항목을 추가하려면 어떻게 해야 할까요? 

그리고 view페이지에서도 첨부된 파일 노출되는 법이 궁금합니다.

 

고수님들의 도움 절실히 부탁드립니다.^^

 

 

--------------------------------------------------------------------------------

 

 

<?

if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

 

if ($is_dhtml_editor) {

    include_once("$g4[path]/lib/cheditor4.lib.php");

    echo "<script src='$g4[cheditor4_path]/cheditor.js'></script>";

    echo cheditor1('wr_content', '100%', '250');

}

?>

 

<script type="text/javascript" language="javascript">

function OnlyNumber(obj, chkint){

  if(isNaN(obj.value)){

    alert("숫자만 입력 가능합니다.");

    obj.value="";

    obj.focus();

    return false;

  }

  if(obj.value > Number(chkint)) {

    alert(chkint+"이하의 숫자만 가능합니다.");

    obj.value="";

    obj.focus();

    return false;

  }

}

</script>

 

 

 

 

<style type="text/css">

.write_head { height:30px; text-align:center; color:#8492A0; }

.field { border:1px solid #ccc; }

 

.head {

height:40px;

width:130px;

text-align:left;

color:#12432d;

}

.head2 {  height:25px; text-align:left; background-color:#FAFAFA; }

.head3 {  height:10px; width:130px; padding-top:10px; padding-bottom:0px;text-align:left;  color:#4c4c4c; }

.head4 {

height:10px;

width:90px;

padding-top:4px;

padding-bottom:0px;

text-align:left;

color:#4c4c4c;

}

.right {  }

 

.nayana {

font-weight: bold;

color: #090;

}

</style>

 

<script type="text/javascript">

// 글자수 제한

var char_min = parseInt(<?=$write_min?>); // 최소

var char_max = parseInt(<?=$write_max?>); // 최대

</script>

 

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js"></script>

 

<form name="fwrite" method="post" onsubmit="return fwrite_submit(this);" enctype="multipart/form-data" style="margin:0px;">

<input type=hidden name=null> 

<input type=hidden name=w        value="<?=$w?>">

<input type=hidden name=bo_table value="<?=$bo_table?>">

<input type=hidden name=wr_id    value="<?=$wr_id?>">

<input type=hidden name=sca      value="<?=$sca?>">

<input type=hidden name=sfl      value="<?=$sfl?>">

<input type=hidden name=stx      value="<?=$stx?>">

<input type=hidden name=spt      value="<?=$spt?>">

<input type=hidden name=sst      value="<?=$sst?>">

<input type=hidden name=sod      value="<?=$sod?>">

<input type=hidden name=page     value="<?=$page?>">

 

<table width="860" align=center cellpadding=0 cellspacing=0>

  <tr><td align="center">

 

 

<table width="860" border="0" align="center" cellpadding="10" cellspacing="3" bordercolor="#ffffff">

 

<tr>

    <td width="260" bgcolor="f3f3ef" class=head><img src="<?=$board_skin_path?>/img/ico_bret.gif" width="15" height="11">업체명</td>

    <td width="400" class="head2"><input class='ed' maxlength=50 size=40 name=wr_name itemname="이름" required value="<?=$name?>"></td>

</tr>

 

 

<!--<? if ($is_password) { ?>

<tr>

    <td width="124" bgcolor="#f7f7ec" class=head><img src="<?=$board_skin_path?>/img/ico_bret.gif" width="15" height="11">게시글암호</td>

    <td><input class='ed' type=password maxlength=20 size=15 name=wr_password itemname="패스워드" <?=$password_required?>> 

     게시글읽기와 수정을 위해 꼭 기억하세요.</td>

</tr>

<? } ?> -->

    

<tr>

    <td width="260" bgcolor="f3f3ef" class=head><img src="<?=$board_skin_path?>/img/ico_bret.gif" width="15" height="11">지역명</td>

    <td width="400" class="head2"><input itemname="지역명"  class='ed' maxlength="30" size="30" name="wr_1" value="<?=$write[wr_1]?>" /> 

       </td>

</tr>

 

<tr>

    <td width="260" bgcolor="f3f3ef" class=head><img src="<?=$board_skin_path?>/img/ico_bret.gif" width="15" height="11">업종</td>

    <td width="400" class="head2"><input itemname="업종"  class='ed' maxlength="30" size="30" name="wr_2" value="<?=$write[wr_2]?>" /> 

       </td>

</tr>

 

<tr>

    <td width="260" bgcolor="f3f3ef" class=head><img src="<?=$board_skin_path?>/img/ico_bret.gif" width="15" height="11">직원수</td>

    <td width="400" class="head2"><input itemname="직원수"  class='ed' maxlength="30" size="30" name="wr_3" value="<?=$write[wr_3]?>" /></td>

</tr>

 

<tr>

    <td width="260" bgcolor="f3f3ef" class=head><img src="<?=$board_skin_path?>/img/ico_bret.gif" width="15" height="11">전화번호</td>

    <td width="400" class="head2"><input itemname="전화번호" required="required" class='ed' maxlength="30" size="30" name="wr_4" value="<?=$write[wr_4]?>" /> 

       연락가능한 전화 및 휴대전화는 필히 기입해주세요.</td>

</tr>

 

 

<tr>

  <td width="260" bgcolor="f3f3ef" class="head"><img src="<?=$board_skin_path?>/img/ico_bret.gif" width="15" height="11">이메일</td>

  <td width="400" class="head2"><input itemname="이메일"  class='ed' maxlength="40" size="40" name="wr_5" value="<?=$write[wr_5]?>" /></td>

</tr>

 

<tr>

  <td width="260" bgcolor="f3f3ef" class=head><img src="<?=$board_skin_path?>/img/ico_bret.gif" width="15" height="11"> 기업부설연구소 유무</td>

  <td width="400" class="head2">

    <table width="504">

      <tr>

        <td><label>

          <input type="radio" name="wr_subject" value="있음" id="wr_subject_0" />

          <span class="nayana">있음</span></label></td>

      </tr>

      <tr>

        <td><label>

          <input type="radio" name="wr_subject" value="없음" id="wr_subject_1" /></label>

          <span class="nayana">없음</span></td>

      </tr>

    </table>

    <!-- 

        <select itemname="신청분야" required="required" name="wr_subject" id="wr_subject">

        <option value=''>자원봉사분야 선택를 선택해주세요.</option>

        <option value='노력봉사' <? if($write['wr_subject'] == '있음') echo 'selected';?>>노력봉사</option>

        <option value='의료봉사' <? if($write['wr_subject'] == '없음') echo 'selected';?>>의료봉사</option>

        <option value='전문봉사' <? if($write['wr_subject'] == '팸투어 문의') echo 'selected';?>>전문봉사</option>

        <option value='공연봉사' <? if($write['wr_subject'] == '기타 문의') echo 'selected';?>>공연봉사</option>

        </select> 

    -->

        

    <!--<input class='ed' style="width:90%;" name=wr_subject id="wr_subject" itemname="신청분야" required value="자원봉사"> -->

    <!--<input class='ed' style="width:90%;" name=wr_subject id="wr_subject" itemname="신청분야" required value="<?=$subject?>"> --></td>

</tr>

 

 

 

<tr>

  <td width="260" bgcolor="f3f3ef" class=head><img src="<?=$board_skin_path?>/img/ico_bret.gif" width="15" height="11"> 급여체계</td>

  <td width="400" class="head2">

    <table width="504">

      <tr>

        <td><label>

          <input type="radio" name="wr_8" value="시급제" id="wr_8_0" />

          <span class="nayana">시급제</span></label></td>

      </tr>

      <tr>

        <td><label>

          <input type="radio" name="wr_8" value="연봉제" id="wr_8_1" /></label>

          <span class="nayana">연봉제</span></td>

      </tr>

    </table>

    <!-- 

        <select itemname="신청분야" required="required" name="wr_subject" id="wr_subject">

        <option value=''>자원봉사분야 선택를 선택해주세요.</option>

        <option value='노력봉사' <? if($write['wr_8'] == '시급제') echo 'selected';?>>노력봉사</option>

        <option value='의료봉사' <? if($write['wr_8'] == '연봉제') echo 'selected';?>>의료봉사</option>

        <option value='전문봉사' <? if($write['wr_8'] == '팸투어 문의') echo 'selected';?>>전문봉사</option>

        <option value='공연봉사' <? if($write['8'] == '기타 문의') echo 'selected';?>>공연봉사</option>

        </select> 

    -->

        

    <!--<input class='ed' style="width:90%;" name=wr_subject id="wr_subject" itemname="신청분야" required value="자원봉사"> -->

    <!--<input class='ed' style="width:90%;" name=wr_subject id="wr_subject" itemname="신청분야" required value="<?=$subject?>"> --></td>

</tr>

    

 

 

 

    

 

<tr>

  <td width="260" bgcolor="f3f3ef" class="head"><img src="<?=$board_skin_path?>/img/ico_bret.gif" width="15" height="11">현재 적용하고 있는비과세 항목</td>

  <td width="400" class="head2">

    <textarea name="wr_content" rows=10 class=ed id="wr_content" style='width:500; word-break:break-all;'

        <? if ($write_min || $write_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?}?>><?=$content?></textarea>

    <? if ($write_min || $write_max) { ?><script type="text/javascript"> check_byte('wr_content', 'char_count'); </script><?}?>    </td>

</tr>

 

 

<tr>

  <td colspan="2" >

<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

    <td align="center" valign="top" style="padding-top:30px;"><input type=image id="btn_submit" src="<?=$board_skin_path?>/img/bt_subit.gif" border=0 accesskey='s'></td>

  </tr>

</table>  </td>

  </tr>

 

 

 

 

<!--파일첨부 추가 -->

<? if ($is_file) { ?>

<!--<tr>

  <td bgcolor="#f7f7ec" class="head">

  <img id='kcaptcha_image' />

  </td>

  <td>

<input class='ed' type=input size=10 name=wr_key itemname="자동등록방지" required>  왼쪽의 글자를 입력하세요.

  </td>

</tr> -->

<? } ?> 

 

 

<!--추가된 암호삭제  -->

</table>

<br />

 

 

 

</td></tr></table>

</td>

</tr></table>

 

</form>

 

 

 

<script type="text/javascript" src="<?="$g4[path]/js/jquery.kcaptcha.js"?>"></script>

<script type="text/javascript">

 

with (document.fwrite) 

{

    if (typeof(wr_subject) != "undefined")

        wr_subject.focus();

    else if (typeof(wr_name) != "undefined")

        wr_name.focus();

    else if (typeof(wr_1) != "undefined")

        wr_1.focus();

 

 

 

 

 

    if (typeof(ca_name) != "undefined")

        if (w.value == "u")

            ca_name.value = "<?=$write[ca_name]?>";

}

 

 

 

 

function html_auto_br(obj) 

{

    if (obj.checked) {

        result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다.");

        if (result)

            obj.value = "html2";

        else

            obj.value = "html1";

    }

    else

        obj.value = "";

}

 

function fwrite_submit(f) 

{

<?

    if ($g4[https_url])

        echo "f.action = '$g4[https_url]/$g4[bbs]/write_update.php';";

    else

        echo "f.action = './write_update.php';";

    ?>

 

    

 

 

    /*

    var s = "";

    if (s = word_filter_check(f.wr_subject.value)) {

        alert("제목에 금지단어('"+s+"')가 포함되어있습니다");

        return false;

    }

 

    if (s = word_filter_check(f.wr_content.value)) {

        alert("내용에 금지단어('"+s+"')가 포함되어있습니다");

        return false;

    }

    */

 

    if (document.getElementById('char_count')) {

        if (char_min > 0 || char_max > 0) {

            var cnt = parseInt(document.getElementById('char_count').innerHTML);

            if (char_min > 0 && char_min > cnt) {

                alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다.");

                return false;

            } 

            else if (char_max > 0 && char_max < cnt) {

                alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");

                return false;

            }

        }

    }

 

 

 

    <?

    if ($is_dhtml_editor) echo cheditor3('wr_content');

    ?>

 

 

   var subject = "";

   var content = "";

    $.ajax({

        url: "<?=$board_skin_path?>/ajax.filter.php",

        type: "POST",

        data: {

            "content": f.wr_content.value

        },

        dataType: "json",

        async: false,

        cache: false,

        success: function(data, textStatus) {

            content = data.content;

        }

    });

 

 

 

    if (content) {

        alert("내용에 금지단어('"+content+"')가 포함되어있습니다");

        if (typeof(ed_wr_content) != "undefined") 

            ed_wr_content.returnFalse();

        else 

            f.wr_content.focus();

        return false;

    }

 

    if (!check_kcaptcha(f.wr_key)) {

        return false;

    }

 

    document.getElementById('btn_submit').disabled = true;

    document.getElementById('btn_cancel').disabled = true;

 

    

    

    return true;

}

</script>

 

<script type="text/javascript" src="<?="$g4[path]/js/board.js"?>"></script>

<script type="text/javascript"> window.onload=function() { drawFont(); } </script>


이 질문에 댓글 쓰기 :

답변 1

단순히 스킨 코드 몇 개 수정한다고 해결되는 문제가 아닌 것 같아요~

없는 기능을 만드시는 거니까 db에서 첨부파일의 unique 한 값이 저장되도록 하셔야 하실 테고.

 

첨부파일로 해킹시도를 할 수 있으니까 validation도 신경을 써 주셔야 합니다.

이 외에도 수정할 부분이 꽤 있습니다.

 

자료실에 한 번 찾아보시거나 의뢰를 하시는걸 추천해 드립니다! ★

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 78
© SIRSOFT
현재 페이지 제일 처음으로