무조건 링크건 화일 다운받기
링크걸면 다운이 안되거나 이상한 이름으로 변경되어 다운되는 경우가 있는데
이걸 해보려고 이리저리 돌아다니고 시간도 많이 잡아 먹었네요.
혹시 저처럼 헤메시는 분 있을까봐 소스 올려드려요.
제가 해본것은 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년 전 | 3541 | ||
| 929 |
|
19년 전 | 2701 | |
| 928 |
|
19년 전 | 3454 | |
| 927 |
|
19년 전 | 3442 | |
| 926 |
|
19년 전 | 3147 | |
| 925 | 19년 전 | 5431 | ||
| 924 |
|
19년 전 | 2167 | |
| 923 |
|
19년 전 | 2216 | |
| 922 |
|
19년 전 | 2311 | |
| 921 |
|
19년 전 | 3405 | |
| 920 | 19년 전 | 3704 | ||
| 919 |
|
19년 전 | 3746 | |
| 918 |
|
19년 전 | 2355 | |
| 917 |
|
19년 전 | 2393 | |
| 916 |
|
19년 전 | 2698 | |
| 915 | 19년 전 | 3040 | ||
| 914 | 19년 전 | 2457 | ||
| 913 | 19년 전 | 2625 | ||
| 912 | 19년 전 | 2454 | ||
| 911 | 19년 전 | 2211 | ||
| 910 | 19년 전 | 3243 | ||
| 909 | 19년 전 | 3296 | ||
| 908 | 19년 전 | 3031 | ||
| 907 |
|
19년 전 | 4871 | |
| 906 |
|
19년 전 | 2706 | |
| 905 |
|
19년 전 | 3315 | |
| 904 |
|
19년 전 | 3140 | |
| 903 |
|
19년 전 | 1988 | |
| 902 |
|
19년 전 | 3132 | |
| 901 |
|
19년 전 | 1869 | |
| 900 |
|
19년 전 | 2330 | |
| 899 |
|
19년 전 | 2401 | |
| 898 |
|
19년 전 | 3983 | |
| 897 |
|
19년 전 | 3184 | |
| 896 |
|
19년 전 | 3097 | |
| 895 |
|
19년 전 | 2535 | |
| 894 |
|
19년 전 | 2011 | |
| 893 |
|
19년 전 | 1643 | |
| 892 |
|
19년 전 | 2410 | |
| 891 |
|
19년 전 | 2327 | |
| 890 |
|
19년 전 | 1813 | |
| 889 |
|
19년 전 | 1810 | |
| 888 |
|
19년 전 | 2606 | |
| 887 |
|
19년 전 | 2579 | |
| 886 |
|
19년 전 | 1874 | |
| 885 |
|
19년 전 | 2108 | |
| 884 |
|
19년 전 | 3299 | |
| 883 |
|
19년 전 | 1950 | |
| 882 |
|
19년 전 | 2496 | |
| 881 |
|
19년 전 | 2578 | |
| 880 |
|
19년 전 | 2657 | |
| 879 |
|
19년 전 | 2936 | |
| 878 |
|
19년 전 | 2558 | |
| 877 |
|
19년 전 | 2982 | |
| 876 |
|
19년 전 | 2761 | |
| 875 |
|
19년 전 | 3521 | |
| 874 | 19년 전 | 1870 | ||
| 873 | 19년 전 | 2729 | ||
| 872 |
|
19년 전 | 2369 | |
| 871 |
|
19년 전 | 2015 | |
| 870 |
|
19년 전 | 2424 | |
| 869 |
|
19년 전 | 1870 | |
| 868 |
|
19년 전 | 5438 | |
| 867 |
|
19년 전 | 2258 | |
| 866 |
|
19년 전 | 4253 | |
| 865 |
|
19년 전 | 2298 | |
| 864 | 19년 전 | 1842 | ||
| 863 | 19년 전 | 2600 | ||
| 862 | 19년 전 | 2330 | ||
| 861 | 19년 전 | 2531 | ||
| 860 | 19년 전 | 2158 | ||
| 859 | 19년 전 | 3918 | ||
| 858 | 19년 전 | 3415 | ||
| 857 | 19년 전 | 2198 | ||
| 856 |
Power
|
19년 전 | 2106 | |
| 855 | 19년 전 | 1971 | ||
| 854 | 19년 전 | 1999 | ||
| 853 |
pearly
|
19년 전 | 4383 | |
| 852 |
pearly
|
19년 전 | 3352 | |
| 851 | 19년 전 | 2773 | ||
| 850 |
pearly
|
19년 전 | 3348 | |
| 849 |
pearly
|
19년 전 | 3007 | |
| 848 |
pearly
|
19년 전 | 2841 | |
| 847 | 19년 전 | 2354 | ||
| 846 |
|
19년 전 | 2164 | |
| 845 |
pearly
|
19년 전 | 2488 | |
| 844 | 19년 전 | 3096 | ||
| 843 | 19년 전 | 2128 | ||
| 842 |
pearly
|
19년 전 | 3121 | |
| 841 |
pearly
|
19년 전 | 3243 | |
| 840 | 19년 전 | 2921 | ||
| 839 |
|
19년 전 | 1935 | |
| 838 |
|
19년 전 | 1700 | |
| 837 |
|
19년 전 | 2321 | |
| 836 |
|
19년 전 | 2262 | |
| 835 |
|
19년 전 | 1641 | |
| 834 |
|
19년 전 | 1664 | |
| 833 |
|
19년 전 | 1568 | |
| 832 |
|
19년 전 | 2065 | |
| 831 |
|
19년 전 | 1616 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기