폼메일에 화일 첨부 하고 싶습니다. 채택완료

화일첨부 하고 싶습니다. 고수님들 부탁드립니다.

Copy
<form name="fcontact" action="<?php echo G5_THEME_URL; ?>/contact_send.php" method="post" onsubmit="return fcontact_submit(this);" enctype="multipart/form-data" >
        <p><input class="w3-input w3-border" type="text" placeholder="이름" required id="con_name" name="con_name"></p>
        <p><input class="w3-input w3-border" type="email" placeholder="이메일" required id="con_email" name="con_email"></p>
        <p><input class="w3-input w3-border" type="text" placeholder="연락처" required id="con_tel"  name="con_tel"></p>
        <p><textarea class="w3-input w3-border" type="text" placeholder="문의내용" required id="con_message" name="con_message" style="height:120px"></textarea></p>
        <p><input class="w3-input w3-border" type="file" id="file1" name="file1"></p>
            <div style="float:left">
                <label for="">자동등록방지</label>
                <div class="captcha"><?php echo captcha_html(); ?></div>
            </div>
            <div class="btnsubmit">
              <button class="w3-button w3-black" style="border-radius:7px;padding:43px 20px" type="submit" id="btn_submit">
                <i class="fa fa-paper-plane"></i> 상담내용 보내기
              </button>
            </div>
      </form>

 

 

 

contact_send.php

Copy
<?php
include_once('./_common.php');
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
include_once(G5_LIB_PATH.'/mailer.lib.php');

//print_r2($_POST); exit;

/*
if (!$is_member && $config['cf_formmail_is_member'])
    alert_close('회원만 이용하실 수 있습니다.');
*/

if (!chk_captcha()) {
    alert('자동등록방지 숫자가 틀렸습니다.');
}

$fnick   = $_POST['con_name'];
$fmail   = $_POST['con_email'];
$to      = $config['cf_admin_email'];
$subject = $config['cf_title'].' 문의';
$content = "이름 : ".$_POST['con_name']."\n연락처 : ".$_POST['con_tel']."\n문의분류 : ".$_POST['wr_2']."\n보낸날 : ".G5_TIME_YMDHIS."\n\n내용 : \n".$_POST['con_message'];
$type    = 2;

$file = array();
for ($i=1; $i<=$attach; $i++) {
    if ($_FILES['file'.$i]['name'])
        $file[] = attach_file($_FILES['file'.$i]['name'], $_FILES['file'.$i]['tmp_name']);
}

$content = stripslashes($content);
if ($type == 2) {
    $type = 1;
    $content = str_replace("\n", "<br>", $content);
}

// html 이면
if ($type) {
    $current_url = G5_URL;
    $mail_content = '<!doctype html><html lang="ko"><head><meta charset="utf-8"><title>메일보내기</title><link rel="stylesheet" href="'.$current_url.'/style.css"></head><body>'.$content.'</body></html>

답변 2개

채택된 답변
+20 포인트

bbs/formmail.php 최신버전 파일 참고하여서 작업하시면 될 것 같습니다

 

아래도 참고해보세요~

https://m.blog.naver.com/PostView.nhn?blogId=oralol&logNo=220050730156&proxyReferer=https%3A%2F%2Fwww.google.co.kr%2

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

답변에 대한 댓글 1개

감사합니다. 덕분에 잘 해결했습니다. bbs/formmail.php 로 해결했습니다. 새해 복 많이 받으세요.

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

안녕하세요. 폼메일에 파일 첨부 기능 어떻게 추가하셨는지 알려주실 수 있을까요?

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

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

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

로그인
🐛 버그신고