php 한글파일명 다운로드 가능하게 (익스플로러8 크롬확인함.)
페이지 정보
본문
<?php
header('Content-Type: text/html; charset=UTF-8');
$downfilename = $_GET['fname'];
$downfiledir = \"../data/file/\";
$downfilename2 = iconv('utf-8', 'cp949//IGNORE', $downfilename);
if(file_exists($downfiledir.$downfilename)){
header(\"Content-Type: application/octet-stream\");
Header(\"Content-Disposition: attachment;; filename=$downfilename2 \");
header(\"Content-Transfer-Encoding: binary\");
Header(\"Content-Length: \".(string)(filesize($downfiledir.$downfilename )));
Header(\"Cache-Control: cache, must-revalidate\");
//header(\"Content-Transfer-Encoding: binary\");
//Header(\"Content-type:file/unknown\");
//Header(\"Content-Description:PHP3 Generated Data\");
header(\"Pragma: no-cache\");
header(\"Expires: 0\");
$fp = fopen($downfiledir.$downfilename , \"rb\");
while(!feof($fp)){
echo fread($fp, 100*1024);
}
fclose ($fp);
flush();
}else {
?>
<script type=\"text/javascript\">alert(\"존재하지 않는 파일입니다.\");history.go(-1);</script>
<?
}
?>
header('Content-Type: text/html; charset=UTF-8');
$downfilename = $_GET['fname'];
$downfiledir = \"../data/file/\";
$downfilename2 = iconv('utf-8', 'cp949//IGNORE', $downfilename);
if(file_exists($downfiledir.$downfilename)){
header(\"Content-Type: application/octet-stream\");
Header(\"Content-Disposition: attachment;; filename=$downfilename2 \");
header(\"Content-Transfer-Encoding: binary\");
Header(\"Content-Length: \".(string)(filesize($downfiledir.$downfilename )));
Header(\"Cache-Control: cache, must-revalidate\");
//header(\"Content-Transfer-Encoding: binary\");
//Header(\"Content-type:file/unknown\");
//Header(\"Content-Description:PHP3 Generated Data\");
header(\"Pragma: no-cache\");
header(\"Expires: 0\");
$fp = fopen($downfiledir.$downfilename , \"rb\");
while(!feof($fp)){
echo fread($fp, 100*1024);
}
fclose ($fp);
flush();
}else {
?>
<script type=\"text/javascript\">alert(\"존재하지 않는 파일입니다.\");history.go(-1);</script>
<?
}
?>
- 이전글javascript 자바스크립트로 form 작성 20.02.21
- 다음글html 문서내 위치 이동하기(화면 이동) 20.02.21
댓글목록
등록된 댓글이 없습니다.