메일에다가 첨부파일 기능을 추가했는데요 첨부가 잘안되요? > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

메일에다가 첨부파일 기능을 추가했는데요 첨부가 잘안되요? 정보

메일에다가 첨부파일 기능을 추가했는데요 첨부가 잘안되요?

본문

---cus_02.php(메일폼)--
<? include($_SERVER['DOCUMENT_ROOT']."/inc/top.html"); ?><head>
<script>
 function disp(){
  var value = document.frm1.custom_name.value;
  var value = document.frm1.custom_email.value;
  var value = document.frm1.custom_contents.value;
  if(value==""){
   alert('고객명,메일주소,전화번호는 필수 항목 입니다.');
  }else{
   frm1.submit();
  }
 }
</script>
</head>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left" valign="top" background="/xmimg/inc/sub_bg.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="33" valign="top"><table width="33" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><img src="/xmimg/cus/subimg_01.gif" width="33" height="87" /></td>
            </tr>
        </table></td>
        <td width="159" align="center" valign="top"><? include("menu.html"); ?></td>
        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td background="/xmimg/cus/cus_bg.gif"><img src="/xmimg/cus/subimg_02.gif" width="808" height="87" /></td>
          </tr>
          <tr>
            <td height="30" background="/xmimg/com/title_bg.gif"><table width="619" height="25" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td align="right">홈>고객지원>제품및기술지원문의</td>
                </tr>
              </table></td>
          </tr>
          <tr>
            <td height="35"><img src="/xmimg/cus/title_02.gif" width="135" height="29" /></td>
          </tr>
          <tr>
            <td valign="top" height="10"></td>
          </tr>
          <tr>
            <td valign="top"><table width="619" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td> </td>
                  <td height="105" valign="top"><div align="left"><img src="/xmimg/cus/img_01.gif" width="451" height="94"></div></td>
                </tr>
                <tr>
                  <td width="19"> </td>
                  <td height="40"><img src="/xmimg/cus/mini_title01_01.gif" width="161" height="24" /></td>
                </tr>
                <tr>
                  <td width="19"> </td>
                  <td valign="top"><table width="600" border="0" cellspacing="0" cellpadding="0">
                  <!-- 메일폼 -->
                  <form name="frm1" enctype="multipart/form-data"  method="post" action="db.php">
                     
                      <tr>
                        <td height="50" valign="top"><table width="600" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td valign="top"><div align="center">
         <tr>
                                      <div align="left"><font color="red">*고객명,메일주소,전화번호는
                                        필수 항목 입니다.</font></div>
                                    </tr>
                                  <table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
                                    <tr>
                                      <td colspan="3" bgcolor="C6B2CC" height="1"></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td width="120" height="33" bgcolor="F8F4F9">
                                        <div align="left"><strong><font color="F8F4F9">___</font></strong><font color="666666"><strong>*</strong></font><strong><font color="#FF6600">
                                          </font></strong>항목</div></td>
                                      <td height="33" > <div align="left">
                                          <table border="0" align="left" cellpadding="0" cellspacing="0">
                                            <tr bgcolor="F8F4F9">
                                              <td height="33" width="95">
                                                <input type="radio" name="custom_to" value="solution" class="메일">
                                                솔루션 문의</td>
                                              <td height="33" width="70">
                                                <input type="radio" name="custom_to" value="bi" class="메일">
                                                BI 문의</td>
                                              <td height="33" width="75">
                                                <input type="radio" name="custom_to" value="as" class="메일">
                                                A/S 문의</td>
                                              <td height="33" width="95"><input type="radio" name="custom_to" value="etc" class="메일">
                                                파트너제휴</td>
                                              <td height="33" width="80"><input type="radio" name="custom_to" value="etc" class="메일">
                                                기타 문의</td>
                                            </tr>
                                          </table>
                                        </div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td height="1" width="120" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="center"></div></td>
                                      <td height="1" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="left"></div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td width="120" height="33" bgcolor="F8F4F9">
                                        <div align="left"><strong><font color="F8F4F9">___</font></strong><font color="ff0000"><strong>*</strong></font><strong>
                                          </strong><font color="ff0000">고객명</font>
                                        </div></td>
                                      <td height="33" class="main02"> <div align="left">
                                          <input type="text" name="custom_name" value="" class="메일">
                                          (법인인 경우 회사명 입력)</div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td height="1" width="120" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="center"></div></td>
                                      <td height="1" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="left"></div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td height="33" width="120"> <div align="left"><strong><font color="F8F4F9">___</font></strong><font color="ff0000"><strong>*</strong></font><strong>
                                          </strong><font color="ff0000">전화번호</font>
                                        </div></td>
                                      <td height="33" class="main02"> <div align="left">
                                          <input type="text" name="custom_phone1" size="7" class="메일">
                                          -
                                          <input type="text" name="custom_phone2" size="7" class="메일">
                                          -
                                          <input type="text" name="custom_phone3" size="7" class="메일">
                                        </div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td height="1" width="120" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="center"></div></td>
                                      <td height="1" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="left"></div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td height="33" width="120"> <div align="left"><strong><font color="F8F4F9">___</font></strong><font color="666666"><strong>*</strong>
                                          </font>핸드폰 </div></td>
                                      <td height="33" class="main02"> <div align="left">
                                          <select name="custom_handphone1" size="1">
                                            <option value="011">011</option>
                                            <option value="016">016</option>
                                            <option value="017">017</option>
                                            <option value="018">018</option>
                                            <option value="010">010</option>
                                          </select>
                                          -
                                          <input type="text" name="custom_handphone2" size="7" class="메일">
                                          -
                                          <input type="text" name="custom_handphone3" size="7" class="메일">
                                        </div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td height="1" width="120" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="center"></div></td>
                                      <td height="1" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="left"></div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td height="33" width="120"> <div align="left"><strong><font color="F8F4F9">___</font></strong><font color="666666"><strong>*</strong></font><strong>
                                          </strong>담당자명 </div></td>
                                      <td height="33" class="main02"> <div align="left">
                                          <input type="text" name="custom_manager" class="메일">
                                          (법인인 경우 담당자명 입력)</div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td height="1" width="120" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="center"></div></td>
                                      <td height="1" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="left"></div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td height="33" width="120"> <div align="left"><strong><font color="F8F4F9">___</font></strong><font color="ff0000"><strong>*</strong></font><strong>
                                          </strong><font color="ff0000">E-Mail</font><strong>
                                          </strong></div></td>
                                      <td height="50" class="main02"> <div align="left">
                                          <input type="text" name="custom_email" size="40" class="메일">
                                          <br>
                                          (답메일이 가능하도록 입력)</div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td height="1" width="120" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="center"></div></td>
                                      <td height="1" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="left"></div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td height="33" width="120"> <div align="left"><strong><font color="F8F4F9">___</font></strong><font color="666666"><strong>*</strong>
                                          </font>제목 </div></td>
                                      <td height="33" class="main02"> <div align="left">
                                          <input type="text" name="custom_title" size="40" class="메일">
                                        </div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
                                      <td height="1" width="120" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="center"></div></td>
                                      <td height="1" bgcolor="F8F4F9" background="/xmimg/pro/dot_01.gif"><div align="left"></div></td>
                                    </tr>
                                    <tr bgcolor="F8F4F9">
         
                                      <td width="120" height="170" bgcolor="F8F4F9">
                                        <div align="left"><strong><font color="F8F4F9">___</font></strong><font color="666666">*</font><strong>
                                          </strong>문의사항 </div></td>
                                      <td height="170" class="main02"> <div align="left">
                                          <textarea name="custom_contents" cols="45" rows="10" class="메일"></textarea>
                                        </div></td>
                                    </tr>
         
        <tr bgcolor="F8F4F9">
                                      <td height="33" width="120"> <div align="left"><strong><font color="F8F4F9">___</font></strong><font color="666666"><strong>*</strong>
                                          </font>첨부파일 </div></td>
                                      <td height="33" class="main02"> <div align="left">
           
                                          <input name="addfile" size=45 " type="file">
                                        </div></td>
                                    </tr>
         
        </tr>
                                    <tr bgcolor="C6B2CC">
                                      <td height="1" colspan="3"></td>
                                    </tr>
                                  </table>
                                </div></td>
                            </tr>
        
                            <tr valign="top">
                              <td height="12" valign="middle" ></td>
                            </tr>
        
                             
        
                            <tr>
                              <td valign="middle" class="main"><div align="center"><img src="/xmimg/cus/but_01.gif"  value=" 멜 전송 " class="메일"  width="58" height="21" hspace="2"  onClick="disp()"><a href=javascript:document.form1.reset()><img src="/xmimg/cus/but_02.gif"   value="  지우기  "  class="메일" width="58" height="21" hspace="2" border="0"></div></td>
   </tr>
    <tr>
                              <td></td>
                            </tr>
                          </table></td>
                      </tr>
                    </table></td>
                </tr>
    
                </form>
              </table></td>
          </tr>
          <tr>
            <td height="40" valign="top"> </td>
          </tr>
   
        </table>
<? include($_SERVER['DOCUMENT_ROOT']."/inc/bottom01.html"); ?>
 
 
-------db.php(메일을 날려주는곳)------------
$tomail = "*** 개인정보보호를 위한 이메일주소 노출방지 ***"; //이 폼메일을 받을 메일주소
function error($text){
 echo "
  <script language=javascript>
  window.alert('$text')
  history.go(-1)
  </script>";
 exit;
}
function msg($text){
 echo "
  <script language=javascript>
  window.alert('$text')
  top.location.href = 'cus_02.php' // 메일발송 후 열리는 페이지
  </script>
 ";
 exit;
}
if (!$custom_to) {error('항목을 선택해주세요');}
if (!$custom_name) {error('이름을 적어주세요');}
if (!$custom_email) {error('메일을 적어주세요');}
if (!$custom_title) {error('제목을 적어주세요');}
if (!$custom_contents) {error('내용을 적어주세요');} 
 
$mailheaders = "Return-Path: $mail \r\n"; // 메일 헤더의 반송 메일 주소
$mailheaders .= "From: $name <$mail>\r\n"; // 메일헤더의 이름과 메일 주소 표시
$body .= " 항목 : $custom_to \r\n";
$body .= " 이름 : $custom_name \r\n";
$body .= "전화번호 : $custom_phone1 - $custom_phone2 - $custom_phone3 \r\n";
$body .= "핸드폰 : $custom_handphone1 - $custom_handphone2 - $custom_handphone3 \r\n";
$body .= "담당자명 : $custom_manager \r\n";
$body .= " 이메일 : $custom_email \r\n";
$body .= " 제목 : $custom_title \r\n";
$body .= " 메일내용 : $custom_contents \r\n";
$body .= " 첨부파일 : ".$PHP_SELF."$addfile \r\n";
 
$result=mail($tomail , $subject , $body , $mailheaders); // 메일 전송
if($result) {msg('메일이 성공적으로 발송되었습니다.');} // 전송 성공시
else{error('메일 발송에 실패하였습니다.');} // 전송 실패시
 
 
이렇게 소스를 작성했는데요 다른 내용들은 잘 전송되는데 첨부파일만 들어오질 않아요
 
 
-------메일 전송 내용--------------
항목 : solution
이름 : 00
전화번호 : 00 - 00 - 00
핸드폰 : 011 - 00 - 00
담당자명 : 00
이메일 : 00
제목 : 00
메일내용 : 안녕 첨부파일 테스트 메일이야~~
첨부파일 : /cus/db.php/tmp/phpLYDXUp
 
위처럼 첨부파일은 경로만 나오고 다운로드하게끔 안되는뎅..
왕초보라서 어케해야하는지..고수님들 부탁 드립니다. ㅜ ㅜ

댓글 전체

전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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