무조건 링크건 화일 다운받기
링크걸면 다운이 안되거나 이상한 이름으로 변경되어 다운되는 경우가 있는데
이걸 해보려고 이리저리 돌아다니고 시간도 많이 잡아 먹었네요.
혹시 저처럼 헤메시는 분 있을까봐 소스 올려드려요.
제가 해본것은 jpg화일과 ai화일 다운되도록 한것 입니다. jpg화일도 그냥 열리는 경우가 대부분인데
jpg다운되구요. ai의 경우 ps확장자로 다운이 되었는데 이걸사용하니 정상적으로 다운되더군요.
-------------------------------------------------------------------------------------------------------
<?
$code = "/home/자신계정아이디/public_html/home/doc/down"; <--- 이부분만 자신의 환경에 맞게
$file="$code/$filename"; // 화일이 실제로 있는 위치를..
$file_size=filesize($file);
// 브라우저 골라서 헤더를 따로 따로 전송 해 준다.(5.5 일때는 다르게 해줘야 함)
if( strstr($HTTP_USER_AGENT,"MSIE 5.5")){
header("Content-Type: doesn/matter ");
header("Content-Disposition: filename=$filename ");
header("Content-Transfer-Encoding: binary ");
header("Pragma: no-cache");
header("Expires: 0");
}else{
Header("Content-type: file/unknown");
Header("Content-Disposition: attachment; filename=$filename");
Header("Content-Description: PHP3 Generated Data");
header("Pragma: no-cache");
header("Expires: 0");
}
if(is_file("$file")){
$fp = fopen("$file","r");
if (!fpassthru($fp))
fclose($fp);
}
?>
사용은
down.php 로 저장하면
down.php?filename=파일명<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
이걸 해보려고 이리저리 돌아다니고 시간도 많이 잡아 먹었네요.
혹시 저처럼 헤메시는 분 있을까봐 소스 올려드려요.
제가 해본것은 jpg화일과 ai화일 다운되도록 한것 입니다. jpg화일도 그냥 열리는 경우가 대부분인데
jpg다운되구요. ai의 경우 ps확장자로 다운이 되었는데 이걸사용하니 정상적으로 다운되더군요.
-------------------------------------------------------------------------------------------------------
<?
$code = "/home/자신계정아이디/public_html/home/doc/down"; <--- 이부분만 자신의 환경에 맞게
$file="$code/$filename"; // 화일이 실제로 있는 위치를..
$file_size=filesize($file);
// 브라우저 골라서 헤더를 따로 따로 전송 해 준다.(5.5 일때는 다르게 해줘야 함)
if( strstr($HTTP_USER_AGENT,"MSIE 5.5")){
header("Content-Type: doesn/matter ");
header("Content-Disposition: filename=$filename ");
header("Content-Transfer-Encoding: binary ");
header("Pragma: no-cache");
header("Expires: 0");
}else{
Header("Content-type: file/unknown");
Header("Content-Disposition: attachment; filename=$filename");
Header("Content-Description: PHP3 Generated Data");
header("Pragma: no-cache");
header("Expires: 0");
}
if(is_file("$file")){
$fp = fopen("$file","r");
if (!fpassthru($fp))
fclose($fp);
}
?>
사용은
down.php 로 저장하면
down.php?filename=파일명<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
댓글 1개
ⓦangcho
19년 전
ㅝ~~~~~~~~~~~
우선, 좋은 정보 감사 합니다~! (__)끄박~!
동영상도? 되나여? ㅋㅋㅋㅋㅋㅋㅋ
동영상도 되면 좋은데 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
우선, 좋은 정보 감사 합니다~! (__)끄박~!
동영상도? 되나여? ㅋㅋㅋㅋㅋㅋㅋ
동영상도 되면 좋은데 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 730 |
|
19년 전 | 2733 | |
| 729 |
그레이스웹
|
19년 전 | 3524 | |
| 728 |
|
19년 전 | 2707 | |
| 727 |
|
19년 전 | 2545 | |
| 726 |
|
19년 전 | 2363 | |
| 725 |
|
19년 전 | 2265 | |
| 724 |
|
19년 전 | 2148 | |
| 723 |
|
19년 전 | 4269 | |
| 722 |
|
19년 전 | 2696 | |
| 721 |
|
19년 전 | 2183 | |
| 720 |
|
19년 전 | 2285 | |
| 719 |
|
19년 전 | 2865 | |
| 718 |
|
19년 전 | 1972 | |
| 717 |
|
19년 전 | 3201 | |
| 716 |
|
19년 전 | 2763 | |
| 715 |
|
19년 전 | 2286 | |
| 714 |
|
19년 전 | 1842 | |
| 713 |
|
19년 전 | 2254 | |
| 712 |
|
19년 전 | 2018 | |
| 711 |
|
19년 전 | 1918 | |
| 710 |
|
19년 전 | 2493 | |
| 709 |
|
19년 전 | 2347 | |
| 708 |
|
19년 전 | 3903 | |
| 707 |
|
19년 전 | 3749 | |
| 706 |
|
19년 전 | 2253 | |
| 705 |
|
19년 전 | 3326 | |
| 704 |
|
19년 전 | 1996 | |
| 703 |
|
19년 전 | 2397 | |
| 702 |
|
19년 전 | 2290 | |
| 701 |
홀로남은자
|
19년 전 | 2358 | |
| 700 |
홀로남은자
|
19년 전 | 2189 | |
| 699 | 19년 전 | 2826 | ||
| 698 |
|
19년 전 | 2847 | |
| 697 |
|
19년 전 | 3187 | |
| 696 |
|
19년 전 | 3055 | |
| 695 |
|
19년 전 | 2729 | |
| 694 |
|
19년 전 | 2954 | |
| 693 |
|
19년 전 | 3205 | |
| 692 |
|
19년 전 | 2891 | |
| 691 |
|
19년 전 | 2636 | |
| 690 | 19년 전 | 2943 | ||
| 689 | 19년 전 | 4520 | ||
| 688 | 19년 전 | 2446 | ||
| 687 | 19년 전 | 2469 | ||
| 686 | 19년 전 | 3496 | ||
| 685 | 19년 전 | 3179 | ||
| 684 | 19년 전 | 2850 | ||
| 683 | 19년 전 | 2072 | ||
| 682 | 19년 전 | 1783 | ||
| 681 | 19년 전 | 2883 | ||
| 680 | 19년 전 | 1738 | ||
| 679 | 19년 전 | 2316 | ||
| 678 | 19년 전 | 3969 | ||
| 677 | 19년 전 | 3754 | ||
| 676 | 19년 전 | 3478 | ||
| 675 | 19년 전 | 3418 | ||
| 674 |
|
19년 전 | 1578 | |
| 673 |
|
19년 전 | 1942 | |
| 672 |
|
19년 전 | 1869 | |
| 671 | 19년 전 | 2536 | ||
| 670 | 19년 전 | 4649 | ||
| 669 |
|
19년 전 | 2779 | |
| 668 |
|
19년 전 | 1933 | |
| 667 |
|
19년 전 | 1953 | |
| 666 |
|
19년 전 | 1858 | |
| 665 |
|
19년 전 | 2588 | |
| 664 |
|
19년 전 | 8188 | |
| 663 |
|
19년 전 | 2744 | |
| 662 |
|
19년 전 | 2800 | |
| 661 |
|
19년 전 | 3058 | |
| 660 |
|
19년 전 | 2229 | |
| 659 |
|
19년 전 | 2247 | |
| 658 |
|
19년 전 | 2186 | |
| 657 |
|
19년 전 | 2092 | |
| 656 |
|
19년 전 | 2287 | |
| 655 |
|
19년 전 | 2545 | |
| 654 |
|
19년 전 | 3087 | |
| 653 | 19년 전 | 2339 | ||
| 652 | 19년 전 | 1923 | ||
| 651 |
|
19년 전 | 2865 | |
| 650 | 19년 전 | 5025 | ||
| 649 | 19년 전 | 3519 | ||
| 648 | 19년 전 | 3478 | ||
| 647 | 19년 전 | 2984 | ||
| 646 | 19년 전 | 2420 | ||
| 645 | 19년 전 | 1507 | ||
| 644 | 19년 전 | 3149 | ||
| 643 | 19년 전 | 2027 | ||
| 642 |
|
19년 전 | 5406 | |
| 641 | 19년 전 | 2442 | ||
| 640 | 19년 전 | 3441 | ||
| 639 | 19년 전 | 2877 | ||
| 638 | 19년 전 | 1771 | ||
| 637 | 19년 전 | 3883 | ||
| 636 | 19년 전 | 2436 | ||
| 635 | 19년 전 | 2324 | ||
| 634 |
|
19년 전 | 3029 | |
| 633 |
|
19년 전 | 3311 | |
| 632 | 19년 전 | 2519 | ||
| 631 | 19년 전 | 2276 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기