php 폼메일에 첨부파일(용량제한 2M)
-
게시물 수정 , 삭제는 로그인 필요
sub03_04.php 파일-------------------------------------------------------
<form name="ask" method="post" action="sub03_04_ok.php">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="63" class="td_b_5_t_5 tr_line_b"><div align="center">이름</div></td>
<td class="td_b_5_t_5 tr_line_b"><input name="name" type="text" class="online" id="name" style="width:200px;"></td>
</tr>
<tr>
<td width="63" class="td_b_5_t_5 tr_line_b"><div align="center">연락처</div></td>
<td class="td_b_5_t_5 tr_line_b"><input name="tel" type="text" class="online" id="tel" style="width:200px;">
<span class="td_11px">예)032-123-1234, 011-123-1234 </span></td>
</tr>
<tr>
<td width="63" class="td_b_5_t_5 tr_line_b"><div align="center">메일주소</div></td>
<td class="td_b_5_t_5 tr_line_b"><input name="mail" type="text" class="online" id="mail" style="width:308px;"></td>
</tr>
<tr>
<td width="63" class="td_b_5_t_5 tr_line_b"><div align="center">파일첨부</div></td>
<td class="td_b_5_t_5 tr_line_b"><input name="file" type="file" class="online" id="file" style="width:400px;"></td>
</tr>
<tr>
<td width="63" class="td_b_5_t_5 tr_line_b"><div align="center">내용</div></td>
<td class="td_b_5_t_5 tr_line_b"><textarea name="con" rows="20" class="online" id="con" style="width:450px;"></textarea></td>
</tr>
<tr align="right" valign="bottom">
<td height="35" colspan="2"><input type="image" name="Submit" value="전송" src="../images/btn_ok.gif" width="88" height="25" onClick="return check();"> <input type="image" name="cancel" value="취소" src="../images/btn_cancel.gif" width="88" height="25" onClick="document.ask.reset();"></td>
</tr>
</table>
</form>
sub03_04_ok.php 파일-------------------------------------------------------
<?
function url_forword($url){
echo ("<meta http-equiv=refresh content=\"0;url=$url\">");
}
function er_msg($str) {
echo("
<script>
window.alert('$str');
history.go(-1);
</script>
");
exit;
}
// 메일보내기(해더포함)
function fnSend($to,$subject,$bodytext,$from){
$to=trim($to);
$subject=chop($subject);
$mailhead="X-Mailer: jusun-mail v0.1\n";
$mailhead.="From:$from\n";
$mailhead.="Reply-To:$from\n";
$mailhead.="Return-Path: $from\n";
$mailhead.="Content-Type: text/html \n";
mail($to,$subject,$bodytext,$mailhead);
}
$bodytext="<table width=\"519\" border=\"1\" borderColor=\"#dfdfdf\" style=\"BORDER-COLLAPSE:collapse\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"84\" bgcolor=\"#E0F8F3\" style=\"padding:7 7 7 7;\"><div align=\"center\">이름</div></td>
<td width=\"437\" style=\"padding:7 7 7 7;\">$name</td>
</tr>
<tr>
<td width=\"84\" bgcolor=\"#E0F8F3\" style=\"padding:7 7 7 7;\"><div align=\"center\">연락처</div></td>
<td style=\"padding:7 7 7 7;\">$tel</td>
</tr>
<tr>
<td width=\"84\" bgcolor=\"#E0F8F3\" style=\"padding:7 7 7 7;\"><div align=\"center\">메일주소</div></td>
<td style=\"padding:7 7 7 7;\">$mail</td>
</tr>
<tr>
<td width=\"84\" bgcolor=\"#E0F8F3\" style=\"padding:7 7 7 7;\"><div align=\"center\">내용</div></td>
<td style=\"padding:7 7 7 7;\">$con</td>
</tr>
</table>";
echo "$bodytext";
fnSend("메일주소","제품 및 견적문의",$bodytext,$mail);
?>
이 소스에 첨부파일이 첨부되게 하려면 어떻게 하나요
고수님들 부탁드립니다.
<form name="ask" method="post" action="sub03_04_ok.php">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="63" class="td_b_5_t_5 tr_line_b"><div align="center">이름</div></td>
<td class="td_b_5_t_5 tr_line_b"><input name="name" type="text" class="online" id="name" style="width:200px;"></td>
</tr>
<tr>
<td width="63" class="td_b_5_t_5 tr_line_b"><div align="center">연락처</div></td>
<td class="td_b_5_t_5 tr_line_b"><input name="tel" type="text" class="online" id="tel" style="width:200px;">
<span class="td_11px">예)032-123-1234, 011-123-1234 </span></td>
</tr>
<tr>
<td width="63" class="td_b_5_t_5 tr_line_b"><div align="center">메일주소</div></td>
<td class="td_b_5_t_5 tr_line_b"><input name="mail" type="text" class="online" id="mail" style="width:308px;"></td>
</tr>
<tr>
<td width="63" class="td_b_5_t_5 tr_line_b"><div align="center">파일첨부</div></td>
<td class="td_b_5_t_5 tr_line_b"><input name="file" type="file" class="online" id="file" style="width:400px;"></td>
</tr>
<tr>
<td width="63" class="td_b_5_t_5 tr_line_b"><div align="center">내용</div></td>
<td class="td_b_5_t_5 tr_line_b"><textarea name="con" rows="20" class="online" id="con" style="width:450px;"></textarea></td>
</tr>
<tr align="right" valign="bottom">
<td height="35" colspan="2"><input type="image" name="Submit" value="전송" src="../images/btn_ok.gif" width="88" height="25" onClick="return check();"> <input type="image" name="cancel" value="취소" src="../images/btn_cancel.gif" width="88" height="25" onClick="document.ask.reset();"></td>
</tr>
</table>
</form>
sub03_04_ok.php 파일-------------------------------------------------------
<?
function url_forword($url){
echo ("<meta http-equiv=refresh content=\"0;url=$url\">");
}
function er_msg($str) {
echo("
<script>
window.alert('$str');
history.go(-1);
</script>
");
exit;
}
// 메일보내기(해더포함)
function fnSend($to,$subject,$bodytext,$from){
$to=trim($to);
$subject=chop($subject);
$mailhead="X-Mailer: jusun-mail v0.1\n";
$mailhead.="From:$from\n";
$mailhead.="Reply-To:$from\n";
$mailhead.="Return-Path: $from\n";
$mailhead.="Content-Type: text/html \n";
mail($to,$subject,$bodytext,$mailhead);
}
$bodytext="<table width=\"519\" border=\"1\" borderColor=\"#dfdfdf\" style=\"BORDER-COLLAPSE:collapse\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"84\" bgcolor=\"#E0F8F3\" style=\"padding:7 7 7 7;\"><div align=\"center\">이름</div></td>
<td width=\"437\" style=\"padding:7 7 7 7;\">$name</td>
</tr>
<tr>
<td width=\"84\" bgcolor=\"#E0F8F3\" style=\"padding:7 7 7 7;\"><div align=\"center\">연락처</div></td>
<td style=\"padding:7 7 7 7;\">$tel</td>
</tr>
<tr>
<td width=\"84\" bgcolor=\"#E0F8F3\" style=\"padding:7 7 7 7;\"><div align=\"center\">메일주소</div></td>
<td style=\"padding:7 7 7 7;\">$mail</td>
</tr>
<tr>
<td width=\"84\" bgcolor=\"#E0F8F3\" style=\"padding:7 7 7 7;\"><div align=\"center\">내용</div></td>
<td style=\"padding:7 7 7 7;\">$con</td>
</tr>
</table>";
echo "$bodytext";
fnSend("메일주소","제품 및 견적문의",$bodytext,$mail);
?>
이 소스에 첨부파일이 첨부되게 하려면 어떻게 하나요
고수님들 부탁드립니다.