http://www.abc.co.kr/download/한글.txt
라는 파일이 있다고 가정했을때
이 파일을 다운받는 방법??
주소창에 넣어서 다운받으면 파일낫파운드가 나옵니다.
이것땜에 코딩을 열심히 했는데 결국 서버에서 안되는거였나요?
클라이언트에서 말고 서버에서 또는 코딩으로 해결할수있는 방법 없을까요?
갖은 꽁수 다 부려서라도...
한글로된 파일들이 많습니다...
근데.. 한가지 궁금한게.. 전 호스팅사에서는 같은방법으로 똑 같은 피씨에서 됐었는데
왜 호스팅 옮기고 안될까요?
답답하네요~~<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>
라는 파일이 있다고 가정했을때
이 파일을 다운받는 방법??
주소창에 넣어서 다운받으면 파일낫파운드가 나옵니다.
이것땜에 코딩을 열심히 했는데 결국 서버에서 안되는거였나요?
클라이언트에서 말고 서버에서 또는 코딩으로 해결할수있는 방법 없을까요?
갖은 꽁수 다 부려서라도...
한글로된 파일들이 많습니다...
근데.. 한가지 궁금한게.. 전 호스팅사에서는 같은방법으로 똑 같은 피씨에서 됐었는데
왜 호스팅 옮기고 안될까요?
답답하네요~~<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>
댓글 3개
14년 전
서버에서 처리하는 방법이 있습니다. 기억이 잘나진 않지만 -ㅂ-;;
Terrorboy
14년 전
dw.php
<?
//$upload_path = "files/";
$filename = $_GET['filename'];
$file_path = $filename;
if(!$filename)
{
echo "{$filename} 파일을 찾을 수 없습니다";
exit;
}
if(eregi("(MSIE)", $HTTP_USER_AGENT)) // 브라우져 구분
{
Header("Content-type: application/octet-stream");
Header("Content-Length: ".filesize($file_path));
Header("Content-Disposition: attachment; filename={$filename}");
Header("Content-Transfer-Encoding: binary");
Header("Cache-control: private");
}
else
{
Header("Content-type: file/unknown");
Header("Content-Length: ".filesize($file_path));
Header("Content-Disposition: attachment; filename=$filename");
Header("Content-Description: PHP Generated Data");
Header("Cache-control: private");
}
$fp = fopen($file_path, "rb");
if($fp)
{
if (!fpassthru($fp)){
fclose($fp);
}
}
echo("<script>self.close();</script>");
?>
<!-- 자스로 브라우저 타이틀 지정 -->
<SCRIPT LANGUAGE="JavaScript">
var defaultTitle = document.title;
function title() {
document.title = "파일 다운로드";
}
if (document.all) title();
</script>
<!-- /자스로 브라우저 타이틀 지정/ -->
다운로드 페이지
<a href='#' onclick="javascript:window.open('dw.php?filename=<?=urlencode("파일주소");?>')" style='color:blue;text-decoration:none;'></a> <br>";
<?
//$upload_path = "files/";
$filename = $_GET['filename'];
$file_path = $filename;
if(!$filename)
{
echo "{$filename} 파일을 찾을 수 없습니다";
exit;
}
if(eregi("(MSIE)", $HTTP_USER_AGENT)) // 브라우져 구분
{
Header("Content-type: application/octet-stream");
Header("Content-Length: ".filesize($file_path));
Header("Content-Disposition: attachment; filename={$filename}");
Header("Content-Transfer-Encoding: binary");
Header("Cache-control: private");
}
else
{
Header("Content-type: file/unknown");
Header("Content-Length: ".filesize($file_path));
Header("Content-Disposition: attachment; filename=$filename");
Header("Content-Description: PHP Generated Data");
Header("Cache-control: private");
}
$fp = fopen($file_path, "rb");
if($fp)
{
if (!fpassthru($fp)){
fclose($fp);
}
}
echo("<script>self.close();</script>");
?>
<!-- 자스로 브라우저 타이틀 지정 -->
<SCRIPT LANGUAGE="JavaScript">
var defaultTitle = document.title;
function title() {
document.title = "파일 다운로드";
}
if (document.all) title();
</script>
<!-- /자스로 브라우저 타이틀 지정/ -->
다운로드 페이지
<a href='#' onclick="javascript:window.open('dw.php?filename=<?=urlencode("파일주소");?>')" style='color:blue;text-decoration:none;'></a> <br>";
14년 전
아직 적용 안해봤용.. 꼭 해보고 알려드릴께요 ^^
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 30 |
아우겐나이스
|
21년 전 | 4031 | |
| 29 |
아우겐나이스
|
21년 전 | 4430 | |
| 28 |
아우겐나이스
|
21년 전 | 3448 | |
| 27 | 21년 전 | 5814 | ||
| 26 | 21년 전 | 3083 | ||
| 25 | 21년 전 | 6062 | ||
| 24 | 18년 전 | 3634 | ||
| 23 | 21년 전 | 3626 | ||
| 22 | 21년 전 | 4235 | ||
| 21 | 21년 전 | 3811 | ||
| 20 | 21년 전 | 4209 | ||
| 19 | 21년 전 | 6668 | ||
| 18 | 21년 전 | 4726 | ||
| 17 | 21년 전 | 6968 | ||
| 16 | 21년 전 | 4160 | ||
| 15 | 21년 전 | 2611 | ||
| 14 | 21년 전 | 4959 | ||
| 13 | 21년 전 | 3389 | ||
| 12 |
Recluse
|
21년 전 | 3861 | |
| 11 |
아우겐나이스
|
21년 전 | 3558 | |
| 10 |
Recluse
|
21년 전 | 3385 | |
| 9 | 21년 전 | 3963 | ||
| 8 | 21년 전 | 5152 | ||
| 7 | 21년 전 | 4749 | ||
| 6 | 21년 전 | 5659 | ||
| 5 | 21년 전 | 4101 | ||
| 4 | 21년 전 | 4821 | ||
| 3 | 21년 전 | 4733 | ||
| 2 | 21년 전 | 3231 | ||
| 1 | 22년 전 | 4331 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기