폼메일 첨부파일 파일명 깨짐현상 채택완료
폼메일을 만들어서 사용하고있습니다.
첨부파일 첨부는 정상적으로 이루어지고 전송도 잘 되는데
첨부파일이 파일명이 한글일 경우 파일명이 깨져서 나오네요.
attach_file 함수를 수정해야될 것 같은데
어떻게 해야 하나요?
아래는 폼메일이 전송되는 액션 페이지 입니다.
</div>
<div><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?
include "./_common.php";
include $g4['path']."/lib/mailer.lib.php";</div>
<div> </div>
<div> $name = $_POST["name"];
$email = $_POST["email"];
$tel = $_POST["tel"];
$4subject = $_POST["subject"];
$content = $_POST["content"];
if($_FILES["file1"]["name"]) $file[] = attach_file($_FILES["file1"]["name"], $_FILES["file1"]["tmp_name"]);
if($_FILES["file2"]["name"]) $file[] = attach_file($_FILES["file2"]["name"], $_FILES["file2"]["tmp_name"]);</div>
<div> $fax = $_POST["fax"];</div>
<div> $content = "<table border='0' cellSpacing='0' cellPadding='0' width='100%'><tbody><tr><td style='BACKGROUND: #999999' height='1' colSpan='2'></td></tr><tr><td style='BACKGROUND: #f1f1f1' height='12' width='130'></td><td></td></tr><tr><td style='BACKGROUND: #f1f1f1' height='30' vAlign='center' width='130' align='left'><span style='PADDING-LEFT: 32px; FONT-FAMILY: Calibri; COLOR: #666666; FONT-SIZE: 14px; FONT-WEIGHT: bold'>작성자</span></td><td style='PADDING-LEFT: 23px' align='left'>".$name."</td></tr><tr><td style='BACKGROUND: #f1f1f1' height='30' vAlign='center' width='130' align='left'><span style='PADDING-LEFT: 32px; FONT-FAMILY: Calibri; COLOR: #666666; FONT-SIZE: 14px; FONT-WEIGHT: bold'>이메일</span></td><td style='PADDING-LEFT: 23px' align='left'>".$email."</td></tr><tr><td style='BACKGROUND: #f1f1f1' height='30' vAlign='center' width='130' align='left'><span style='PADDING-LEFT: 32px; FONT-FAMILY: Calibri; COLOR: #666666; FONT-SIZE: 14px; FONT-WEIGHT: bold'>연락처</span></td><td style='PADDING-LEFT: 23px' align='left'>".$tel."</td></tr><tr><td style='BACKGROUND: #f1f1f1' height='30' vAlign='center' width='130' align='left'><span style='PADDING-LEFT: 32px; FONT-FAMILY: Calibri; COLOR: #666666; FONT-SIZE: 14px; FONT-WEIGHT: bold'>제목</span></td><td style='PADDING-LEFT: 23px' align='left'>".$subject."</td></tr><tr><td style='BACKGROUND: #f1f1f1' height='120' vAlign='center' width='130' align='left'><span style='PADDING-LEFT: 32px; FONT-FAMILY: Calibri; COLOR: #666666; FONT-SIZE: 14px; FONT-WEIGHT: bold'>내용</span></td><td style='PADDING-LEFT: 23px' align='left'>".nl2br($content)."</td></tr><tr><td style='BACKGROUND: #f1f1f1' height='10' vAlign='center' width='130' align='left'></td><td></td></tr><tr><td style='BACKGROUND: #999999' height='1' colSpan='2'></td></tr></tbody></table>";</div>
<div>
mailer($name, $email, " <a href="mailto:abcd@hanmail.net" target="_blank">abcd@hanmail.net</a>", "[문의]".$subject, $content, 1, $file);
echo "<script type='text/javascript'>";
echo "alert('접수되었습니다.');";
echo "parent.document.location.reload();";
echo "</script>";
?></div>
<div>
댓글을 작성하려면 로그인이 필요합니다.
답변 3개
채택된 답변
+20 포인트
11년 전
</span></font></div><code class="plain" style="line-height: 23.54400062561035px; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important">attach_file(iconv("EUC-KR", "UTF-8", </code><code class="variable" style="line-height: 23.54400062561035px; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: rgb(170, 119, 0) !important">$_FILES</code><code class="plain" style="line-height: 23.54400062561035px; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important">[</code><code class="string" style="line-height: 23.54400062561035px; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: blue !important">"file1"</code><code class="plain" style="line-height: 23.54400062561035px; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important">][</code><code class="string" style="line-height: 23.54400062561035px; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: blue !important">"name"</code><code class="plain" style="line-height: 23.54400062561035px; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important">]), ......</code>
<div><code class="plain" style="line-height: 23.54400062561035px; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important">
이렇게 수정하면 안되나요 혹시..?
로그인 후 평가할 수 있습니다
답변에 대한 댓글 3개
�
11년 전
A
11년 전
다행이네요..
문서에 utf-8 이라구 명시되있길래..
문서가 euc-kr이면 저것두 euc-kr루 바꿔주세요..
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
이부분
문서에 utf-8 이라구 명시되있길래..
문서가 euc-kr이면 저것두 euc-kr루 바꿔주세요..
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
이부분
�
11년 전
문서는 utf-8입니다.
meta도 utf-8이고
폼메일이 있는 페이지도 utf-8입니다. 그누보드도 utf-8이고요. utf-8로 만들어진 홈페이지인데
이상하게 euc-kr로 변환을 해야 파일명이 안깨지네요.
그래도 일단 해결은 됐으니 다행입니다. 여러가지 테스트 해 봤는데 정상적으로 작동합니다...
meta도 utf-8이고
폼메일이 있는 페이지도 utf-8입니다. 그누보드도 utf-8이고요. utf-8로 만들어진 홈페이지인데
이상하게 euc-kr로 변환을 해야 파일명이 안깨지네요.
그래도 일단 해결은 됐으니 다행입니다. 여러가지 테스트 해 봤는데 정상적으로 작동합니다...
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인전체 질문 목록
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
채택
답변대기
답변대기
답변대기
답변대기
채택
채택
답변대기
답변대기
답변대기
채택
iconv("UTF-8", "EUC-KR", $_FILES["file1"]["name"])
[/code]
로 바꿔서 해결했습니다 ^^