무조건 링크건 화일 다운받기
링크걸면 다운이 안되거나 이상한 이름으로 변경되어 다운되는 경우가 있는데
이걸 해보려고 이리저리 돌아다니고 시간도 많이 잡아 먹었네요.
혹시 저처럼 헤메시는 분 있을까봐 소스 올려드려요.
제가 해본것은 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년 전
ㅝ~~~~~~~~~~~
우선, 좋은 정보 감사 합니다~! (__)끄박~!
동영상도? 되나여? ㅋㅋㅋㅋㅋㅋㅋ
동영상도 되면 좋은데 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
우선, 좋은 정보 감사 합니다~! (__)끄박~!
동영상도? 되나여? ㅋㅋㅋㅋㅋㅋㅋ
동영상도 되면 좋은데 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 930 | 19년 전 | 3554 | ||
| 929 |
|
19년 전 | 2724 | |
| 928 |
|
19년 전 | 3462 | |
| 927 |
|
19년 전 | 3457 | |
| 926 |
|
19년 전 | 3155 | |
| 925 | 19년 전 | 5447 | ||
| 924 |
|
19년 전 | 2185 | |
| 923 |
|
19년 전 | 2245 | |
| 922 |
|
19년 전 | 2330 | |
| 921 |
|
19년 전 | 3422 | |
| 920 | 19년 전 | 3718 | ||
| 919 |
|
19년 전 | 3761 | |
| 918 |
|
19년 전 | 2382 | |
| 917 |
|
19년 전 | 2412 | |
| 916 |
|
19년 전 | 2721 | |
| 915 | 19년 전 | 3068 | ||
| 914 | 19년 전 | 2474 | ||
| 913 | 19년 전 | 2637 | ||
| 912 | 19년 전 | 2466 | ||
| 911 | 19년 전 | 2233 | ||
| 910 | 19년 전 | 3262 | ||
| 909 | 19년 전 | 3326 | ||
| 908 | 19년 전 | 3056 | ||
| 907 |
|
19년 전 | 4882 | |
| 906 |
|
19년 전 | 2724 | |
| 905 |
|
19년 전 | 3323 | |
| 904 |
|
19년 전 | 3167 | |
| 903 |
|
19년 전 | 2009 | |
| 902 |
|
19년 전 | 3163 | |
| 901 |
|
19년 전 | 1896 | |
| 900 |
|
19년 전 | 2353 | |
| 899 |
|
19년 전 | 2412 | |
| 898 |
|
19년 전 | 4002 | |
| 897 |
|
19년 전 | 3206 | |
| 896 |
|
19년 전 | 3118 | |
| 895 |
|
19년 전 | 2553 | |
| 894 |
|
19년 전 | 2032 | |
| 893 |
|
19년 전 | 1663 | |
| 892 |
|
19년 전 | 2429 | |
| 891 |
|
19년 전 | 2342 | |
| 890 |
|
19년 전 | 1825 | |
| 889 |
|
19년 전 | 1826 | |
| 888 |
|
19년 전 | 2619 | |
| 887 |
|
19년 전 | 2590 | |
| 886 |
|
19년 전 | 1880 | |
| 885 |
|
19년 전 | 2131 | |
| 884 |
|
19년 전 | 3318 | |
| 883 |
|
19년 전 | 1963 | |
| 882 |
|
19년 전 | 2516 | |
| 881 |
|
19년 전 | 2598 | |
| 880 |
|
19년 전 | 2675 | |
| 879 |
|
19년 전 | 2948 | |
| 878 |
|
19년 전 | 2570 | |
| 877 |
|
19년 전 | 2992 | |
| 876 |
|
19년 전 | 2767 | |
| 875 |
|
19년 전 | 3527 | |
| 874 | 19년 전 | 1881 | ||
| 873 | 19년 전 | 2748 | ||
| 872 |
|
19년 전 | 2385 | |
| 871 |
|
19년 전 | 2030 | |
| 870 |
|
19년 전 | 2436 | |
| 869 |
|
19년 전 | 1880 | |
| 868 |
|
19년 전 | 5453 | |
| 867 |
|
19년 전 | 2278 | |
| 866 |
|
19년 전 | 4282 | |
| 865 |
|
19년 전 | 2317 | |
| 864 | 19년 전 | 1868 | ||
| 863 | 19년 전 | 2624 | ||
| 862 | 19년 전 | 2342 | ||
| 861 | 19년 전 | 2541 | ||
| 860 | 19년 전 | 2183 | ||
| 859 | 19년 전 | 3933 | ||
| 858 | 19년 전 | 3430 | ||
| 857 | 19년 전 | 2217 | ||
| 856 |
Power
|
19년 전 | 2114 | |
| 855 | 19년 전 | 1979 | ||
| 854 | 19년 전 | 2015 | ||
| 853 |
pearly
|
19년 전 | 4417 | |
| 852 |
pearly
|
19년 전 | 3367 | |
| 851 | 19년 전 | 2788 | ||
| 850 |
pearly
|
19년 전 | 3362 | |
| 849 |
pearly
|
19년 전 | 3020 | |
| 848 |
pearly
|
19년 전 | 2859 | |
| 847 | 19년 전 | 2383 | ||
| 846 |
|
19년 전 | 2193 | |
| 845 |
pearly
|
19년 전 | 2512 | |
| 844 | 19년 전 | 3118 | ||
| 843 | 19년 전 | 2148 | ||
| 842 |
pearly
|
19년 전 | 3133 | |
| 841 |
pearly
|
19년 전 | 3256 | |
| 840 | 19년 전 | 2944 | ||
| 839 |
|
19년 전 | 1956 | |
| 838 |
|
19년 전 | 1719 | |
| 837 |
|
19년 전 | 2341 | |
| 836 |
|
19년 전 | 2290 | |
| 835 |
|
19년 전 | 1664 | |
| 834 |
|
19년 전 | 1678 | |
| 833 |
|
19년 전 | 1584 | |
| 832 |
|
19년 전 | 2076 | |
| 831 |
|
19년 전 | 1626 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기