fumail 폼메일에서 파일 첨부??? 정보
fumail 폼메일에서 파일 첨부???
관련링크
본문
fumail 폼메일에서 파일 첨부 가능한가요?
다른폼메일에는 보통 파일첨부가있는데 여기는 없어서 만들어보고싶은데.
검색해도 별다른 내용이 없어 질문드립니다.
고수님들 부탁드립니다.
댓글 전체

sjs_fumail.php
<?
include_once("./_common.php");
// 전화, 휴대폰 배열
$phone_array = array("02","031","032","033","041","042","043","051","052","053","054","055","061","062","063","064");//,"0502","0505","0506");
$mobile_array = array("010","011","016","017","018","019");
$g4[title] = "";
include_once("$g4[path]/_head.php");
?>
<!-- 한글 필드명으로 인해 사용안함
<SCRIPT LANGUAGE="JavaScript">
<!--
function fo_move(len,fld1,fld2){
if(fld1.value.length == len){
fld2.focus();
}
}
</SCRIPT>
//-->
<script language="JavaScript">
<!--
/* 김선용 - 폼내용중에 라디오박스나 체크박스를 필수선택으로 할 경우 이 주석처리를 변경하여 사용하십시오.
function checkform(){
//var f = document.form;
var getobj = document.getElementsByTagName("input");
var chkfld = false;
for(var i=0; i<getobj.length; i++){
//if((getobj[i].type == "checkbox" || getobj[i].type == "radio") && getobj[i].checked == true){
if(getobj[i].type == "radio" && getobj[i].checked == true){
chkfld = true;
break;
}
}
if(chkfld == false){
alert("라디오박스 필수");
return false;
}
return true;
}
//-->
*/
</script>
<br><hr>
- <font color='#3300FF'>신청인 정보</font> 의 메일주소를 입력하면 테스트용 폼메일 예제를 받아볼 수 있습니다.<br>
- 아래 입력/선택한 항목들의 값이 실제로 메일로 어떻게 보내지는지 알 수 있습니다.<br>
<font color="#FF0000">- 체크박스/라디오박스/입력박스/텍스트박스 등 모든 입력받을 필드를 무한대로 늘릴 수 있으며, 이 페이지에서만 늘려주면 다른 파일은 아무것도 수정할 필요가 없습니다.</font>
<hr>
<form name="fumail" method="post" action="./sjs_fumail_update.php" onsubmit="return checkform();">
<input type="hidden" name="attach" value="2">
<p>■ 신청인 정보
<TABLE width='100%' border='1' bordercolor='#CACA00' cellpadding='4' cellspacing='0' style='border-collapse:collapse;'>
<col width="15%" style="font:bold;" bgcolor="#FAF9EF" align="center">
<col width="35%">
<col width="15%" style="font:bold;" bgcolor="#FAF9EF" align="center">
<col width="35%">
<tr>
<td>이름</td>
<td><input type='text' name='이름' size=20 required itemname="이름"></td>
<td>메일주소</td>
<td><input type='text' name='email' style="width:99%;" email required itemname="메일주소">
</tr>
<tr>
<td>일반전화</td>
<td>
<select name='일반전화(지역번호)'>
<option value=''>-지역선택-</option>
<?
for($a=0;$a<count($phone_array);$a++){
echo "<option value='$phone_array[$a]'>$phone_array[$a]</option>";
}
?>
</select>
<input type='text' name='일반전화(국번)' size='4' maxlength='4' numeric> -
<input type='text' name='일반전화(번호)' size='4' maxlength='4' numeric>
</td>
<td>휴대전화</td>
<td>
<select name='휴대전화(통신사)'>
<option value=''>-통신사선택-</option>
<?
for($m=0;$m<count($mobile_array);$m++){
echo "<option value='$mobile_array[$m]'>$mobile_array[$m]</option>";
}
?>
</select>
<input type='text' name='휴대전화(국번)' size='4' maxlength='4' numeric> -
<input type='text' name='휴대전화(번호)' size='4' maxlength='4' numeric>
</td>
</tr>
</table>
<p>■ 테스트 입력사항 1
<TABLE width='100%' border='1' bordercolor='#CACA00' cellpadding='4' cellspacing='0' style='border-collapse:collapse;'>
<col width="15%" style="font:bold;" bgcolor="#FAF9EF" align="center">
<col width="35%">
<col width="15%" style="font:bold;" bgcolor="#FAF9EF" align="center">
<col width="35%">
<tr>
<td>체크박스</td>
<td>
<INPUT TYPE="checkbox" NAME="체크설문1" value="예">설문1
<INPUT TYPE="checkbox" NAME="체크설문2" value="예">설문2
<INPUT TYPE="checkbox" NAME="체크설문3" value="예">설문3
<INPUT TYPE="checkbox" NAME="체크설문4" value="예">설문4
<INPUT TYPE="checkbox" NAME="체크설문5" value="예">설문5
<INPUT TYPE="checkbox" NAME="체크설문6" value="예">설문6
</td>
<td>라디오박스</td>
<td>좋아하는 연예인은???<br>
<INPUT TYPE="radio" NAME="라디오설문" value="연예인1">연예인1
<INPUT TYPE="radio" NAME="라디오설문" value="연예인2">연예인2
<INPUT TYPE="radio" NAME="라디오설문" value="연예인3">연예인3<br>
<INPUT TYPE="radio" NAME="라디오설문" value="연예인4">연예인4
<INPUT TYPE="radio" NAME="라디오설문" value="연예인5">연예인5
<INPUT TYPE="radio" NAME="라디오설문" value="연예인6">연예인6
</td>
</tr>
</table>
<p>■ 테스트 입력사항 2
<TABLE width='100%' border='1' bordercolor='#CACA00' cellpadding='4' cellspacing='0' style='border-collapse:collapse;'>
<col width="15%" style="font:bold;" bgcolor="#FAF9EF" align="center">
<col width="35%">
<col width="15%" style="font:bold;" bgcolor="#FAF9EF" align="center">
<col width="35%">
<tr>
<td>입력박스1</td>
<td><INPUT TYPE="text" NAME="입력박스1" style="width:99%;"></td>
<td>입력박스2</td>
<td><INPUT TYPE="text" NAME="입력박스2" style="width:99%;"></td>
</tr>
<tr>
<td>텍스트박스</td>
<td colspan=3 bgcolor="#ffffff"><TEXTAREA NAME="텍스트박스" ROWS="5" style="width:99%;"></TEXTAREA></td>
</tr>
</table>
<table width="540" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80" height="27" align="center">첨부파일 #1</td>
<td width="10" valign="bottom"><img src="<?=$member_skin_path?>/img/l.gif" width="1" height="8"></td>
<td width="450"><input type=file style='width:90%;' name='file1'></td>
</tr>
<tr>
<td height="1" colspan="3" bgcolor="#E9E9E9"></td>
</tr>
<tr>
<td width="80" height="27" align="center">첨부파일 #2</td>
<td width="10" valign="bottom"><img src="<?=$member_skin_path?>/img/l.gif" width="1" height="8"></td>
<td width="450"><input type=file style='width:90%;' name='file2'></td>
</tr>
<tr>
<td height="1" colspan="3" bgcolor="#E9E9E9"></td>
</tr>
</table>
<p align="center"><input type='submit' value=' 입/력/완/료 '>
</form>
<?
include_once("./_tail.php");
?>
sjs_fumail_update.php
<?
include_once("./_common.php");
include_once("$g4[path]/lib/mailer.lib.php");
if(empty($_POST["이름"])){
alert("필수값이 넘어오지 않았습니다.\\n\\n다시 확인하십시오.");
}
while(list($key,$val) = each($_POST)){
if($key == "faction" || $key == "x" || $key == "y") continue;
if(empty($val)) continue; // 텍스트박스/입력박스 사용시에 적용
$arrkey[] = $key;
$arrval[] = $val;
}
for ($i=1; $i<=$attach; $i++)
{
if ($_FILES["file".$i][name])
$file[] = attach_file($_FILES["file".$i][name], $_FILES["file".$i][tmp_name]);
}
// 메일발송
// 실제 사용시 제목을 수정하십시오.
//$subject = $_POST["이름"] . " 님이 신청한 내용";
$subject = "www.sjsjin.com 의 테스트 메일입니다.";
$admin = get_admin('super');
//$admin[mb_email] = $_POST['email'];
ob_start();
include "./sjs_fumail_post.php";
$content = ob_get_contents();
ob_end_clean();
mailer($_POST["이름"], $email, $admin[mb_email], $subject, $content, 1, $file); // 마지막에 숫자 1을 변경하지 마십시오.
// 메일발송 후 돌아가고자 하는 페이지가 index.php 가 아니라면 아래에서 $g4[path] 를 이동하고자 하는 경로로 수정해 주십시오.
alert("테스트 메일발송 완료","$g4[path]");
?>
<?
include_once("./_common.php");
// 전화, 휴대폰 배열
$phone_array = array("02","031","032","033","041","042","043","051","052","053","054","055","061","062","063","064");//,"0502","0505","0506");
$mobile_array = array("010","011","016","017","018","019");
$g4[title] = "";
include_once("$g4[path]/_head.php");
?>
<!-- 한글 필드명으로 인해 사용안함
<SCRIPT LANGUAGE="JavaScript">
<!--
function fo_move(len,fld1,fld2){
if(fld1.value.length == len){
fld2.focus();
}
}
</SCRIPT>
//-->
<script language="JavaScript">
<!--
/* 김선용 - 폼내용중에 라디오박스나 체크박스를 필수선택으로 할 경우 이 주석처리를 변경하여 사용하십시오.
function checkform(){
//var f = document.form;
var getobj = document.getElementsByTagName("input");
var chkfld = false;
for(var i=0; i<getobj.length; i++){
//if((getobj[i].type == "checkbox" || getobj[i].type == "radio") && getobj[i].checked == true){
if(getobj[i].type == "radio" && getobj[i].checked == true){
chkfld = true;
break;
}
}
if(chkfld == false){
alert("라디오박스 필수");
return false;
}
return true;
}
//-->
*/
</script>
<br><hr>
- <font color='#3300FF'>신청인 정보</font> 의 메일주소를 입력하면 테스트용 폼메일 예제를 받아볼 수 있습니다.<br>
- 아래 입력/선택한 항목들의 값이 실제로 메일로 어떻게 보내지는지 알 수 있습니다.<br>
<font color="#FF0000">- 체크박스/라디오박스/입력박스/텍스트박스 등 모든 입력받을 필드를 무한대로 늘릴 수 있으며, 이 페이지에서만 늘려주면 다른 파일은 아무것도 수정할 필요가 없습니다.</font>
<hr>
<form name="fumail" method="post" action="./sjs_fumail_update.php" onsubmit="return checkform();">
<input type="hidden" name="attach" value="2">
<p>■ 신청인 정보
<TABLE width='100%' border='1' bordercolor='#CACA00' cellpadding='4' cellspacing='0' style='border-collapse:collapse;'>
<col width="15%" style="font:bold;" bgcolor="#FAF9EF" align="center">
<col width="35%">
<col width="15%" style="font:bold;" bgcolor="#FAF9EF" align="center">
<col width="35%">
<tr>
<td>이름</td>
<td><input type='text' name='이름' size=20 required itemname="이름"></td>
<td>메일주소</td>
<td><input type='text' name='email' style="width:99%;" email required itemname="메일주소">
</tr>
<tr>
<td>일반전화</td>
<td>
<select name='일반전화(지역번호)'>
<option value=''>-지역선택-</option>
<?
for($a=0;$a<count($phone_array);$a++){
echo "<option value='$phone_array[$a]'>$phone_array[$a]</option>";
}
?>
</select>
<input type='text' name='일반전화(국번)' size='4' maxlength='4' numeric> -
<input type='text' name='일반전화(번호)' size='4' maxlength='4' numeric>
</td>
<td>휴대전화</td>
<td>
<select name='휴대전화(통신사)'>
<option value=''>-통신사선택-</option>
<?
for($m=0;$m<count($mobile_array);$m++){
echo "<option value='$mobile_array[$m]'>$mobile_array[$m]</option>";
}
?>
</select>
<input type='text' name='휴대전화(국번)' size='4' maxlength='4' numeric> -
<input type='text' name='휴대전화(번호)' size='4' maxlength='4' numeric>
</td>
</tr>
</table>
<p>■ 테스트 입력사항 1
<TABLE width='100%' border='1' bordercolor='#CACA00' cellpadding='4' cellspacing='0' style='border-collapse:collapse;'>
<col width="15%" style="font:bold;" bgcolor="#FAF9EF" align="center">
<col width="35%">
<col width="15%" style="font:bold;" bgcolor="#FAF9EF" align="center">
<col width="35%">
<tr>
<td>체크박스</td>
<td>
<INPUT TYPE="checkbox" NAME="체크설문1" value="예">설문1
<INPUT TYPE="checkbox" NAME="체크설문2" value="예">설문2
<INPUT TYPE="checkbox" NAME="체크설문3" value="예">설문3
<INPUT TYPE="checkbox" NAME="체크설문4" value="예">설문4
<INPUT TYPE="checkbox" NAME="체크설문5" value="예">설문5
<INPUT TYPE="checkbox" NAME="체크설문6" value="예">설문6
</td>
<td>라디오박스</td>
<td>좋아하는 연예인은???<br>
<INPUT TYPE="radio" NAME="라디오설문" value="연예인1">연예인1
<INPUT TYPE="radio" NAME="라디오설문" value="연예인2">연예인2
<INPUT TYPE="radio" NAME="라디오설문" value="연예인3">연예인3<br>
<INPUT TYPE="radio" NAME="라디오설문" value="연예인4">연예인4
<INPUT TYPE="radio" NAME="라디오설문" value="연예인5">연예인5
<INPUT TYPE="radio" NAME="라디오설문" value="연예인6">연예인6
</td>
</tr>
</table>
<p>■ 테스트 입력사항 2
<TABLE width='100%' border='1' bordercolor='#CACA00' cellpadding='4' cellspacing='0' style='border-collapse:collapse;'>
<col width="15%" style="font:bold;" bgcolor="#FAF9EF" align="center">
<col width="35%">
<col width="15%" style="font:bold;" bgcolor="#FAF9EF" align="center">
<col width="35%">
<tr>
<td>입력박스1</td>
<td><INPUT TYPE="text" NAME="입력박스1" style="width:99%;"></td>
<td>입력박스2</td>
<td><INPUT TYPE="text" NAME="입력박스2" style="width:99%;"></td>
</tr>
<tr>
<td>텍스트박스</td>
<td colspan=3 bgcolor="#ffffff"><TEXTAREA NAME="텍스트박스" ROWS="5" style="width:99%;"></TEXTAREA></td>
</tr>
</table>
<table width="540" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80" height="27" align="center">첨부파일 #1</td>
<td width="10" valign="bottom"><img src="<?=$member_skin_path?>/img/l.gif" width="1" height="8"></td>
<td width="450"><input type=file style='width:90%;' name='file1'></td>
</tr>
<tr>
<td height="1" colspan="3" bgcolor="#E9E9E9"></td>
</tr>
<tr>
<td width="80" height="27" align="center">첨부파일 #2</td>
<td width="10" valign="bottom"><img src="<?=$member_skin_path?>/img/l.gif" width="1" height="8"></td>
<td width="450"><input type=file style='width:90%;' name='file2'></td>
</tr>
<tr>
<td height="1" colspan="3" bgcolor="#E9E9E9"></td>
</tr>
</table>
<p align="center"><input type='submit' value=' 입/력/완/료 '>
</form>
<?
include_once("./_tail.php");
?>
sjs_fumail_update.php
<?
include_once("./_common.php");
include_once("$g4[path]/lib/mailer.lib.php");
if(empty($_POST["이름"])){
alert("필수값이 넘어오지 않았습니다.\\n\\n다시 확인하십시오.");
}
while(list($key,$val) = each($_POST)){
if($key == "faction" || $key == "x" || $key == "y") continue;
if(empty($val)) continue; // 텍스트박스/입력박스 사용시에 적용
$arrkey[] = $key;
$arrval[] = $val;
}
for ($i=1; $i<=$attach; $i++)
{
if ($_FILES["file".$i][name])
$file[] = attach_file($_FILES["file".$i][name], $_FILES["file".$i][tmp_name]);
}
// 메일발송
// 실제 사용시 제목을 수정하십시오.
//$subject = $_POST["이름"] . " 님이 신청한 내용";
$subject = "www.sjsjin.com 의 테스트 메일입니다.";
$admin = get_admin('super');
//$admin[mb_email] = $_POST['email'];
ob_start();
include "./sjs_fumail_post.php";
$content = ob_get_contents();
ob_end_clean();
mailer($_POST["이름"], $email, $admin[mb_email], $subject, $content, 1, $file); // 마지막에 숫자 1을 변경하지 마십시오.
// 메일발송 후 돌아가고자 하는 페이지가 index.php 가 아니라면 아래에서 $g4[path] 를 이동하고자 하는 경로로 수정해 주십시오.
alert("테스트 메일발송 완료","$g4[path]");
?>

앗~ 이거 안되네요,
file1 D:\....CHOICE\images\menu_11.gif 이렇게 오네요, ㅜㅜ
file1 D:\....CHOICE\images\menu_11.gif 이렇게 오네요, ㅜㅜ