폼메일에 화일 첨부 하고 싶습니다.

폼메일에 화일 첨부 하고 싶습니다.

QA

폼메일에 화일 첨부 하고 싶습니다.

본문

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


<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


<?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

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

 

아래도 참고해보세요~

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

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

회원로그인

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