무조건 링크건 화일 다운받기
링크걸면 다운이 안되거나 이상한 이름으로 변경되어 다운되는 경우가 있는데
이걸 해보려고 이리저리 돌아다니고 시간도 많이 잡아 먹었네요.
혹시 저처럼 헤메시는 분 있을까봐 소스 올려드려요.
제가 해본것은 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년 전
ㅝ~~~~~~~~~~~
우선, 좋은 정보 감사 합니다~! (__)끄박~!
동영상도? 되나여? ㅋㅋㅋㅋㅋㅋㅋ
동영상도 되면 좋은데 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
우선, 좋은 정보 감사 합니다~! (__)끄박~!
동영상도? 되나여? ㅋㅋㅋㅋㅋㅋㅋ
동영상도 되면 좋은데 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 830 |
|
19년 전 | 2180 | |
| 829 |
|
19년 전 | 1914 | |
| 828 |
|
19년 전 | 1807 | |
| 827 |
|
19년 전 | 1653 | |
| 826 |
|
19년 전 | 1845 | |
| 825 |
|
19년 전 | 1886 | |
| 824 |
|
19년 전 | 1942 | |
| 823 |
|
19년 전 | 2687 | |
| 822 |
|
19년 전 | 5316 | |
| 821 |
|
19년 전 | 1720 | |
| 820 |
|
19년 전 | 1573 | |
| 819 |
|
19년 전 | 1433 | |
| 818 |
|
19년 전 | 1594 | |
| 817 |
|
19년 전 | 1520 | |
| 816 |
|
19년 전 | 1442 | |
| 815 |
|
19년 전 | 1456 | |
| 814 |
|
19년 전 | 1377 | |
| 813 |
|
19년 전 | 1440 | |
| 812 | 19년 전 | 2815 | ||
| 811 |
pearly
|
19년 전 | 3831 | |
| 810 |
pearly
|
19년 전 | 5208 | |
| 809 |
|
19년 전 | 1374 | |
| 808 |
pearly
|
19년 전 | 4538 | |
| 807 | 19년 전 | 2978 | ||
| 806 |
|
19년 전 | 1495 | |
| 805 |
|
19년 전 | 2689 | |
| 804 |
|
19년 전 | 3615 | |
| 803 |
|
19년 전 | 1797 | |
| 802 |
|
19년 전 | 3788 | |
| 801 |
|
19년 전 | 1879 | |
| 800 | 19년 전 | 3770 | ||
| 799 | 19년 전 | 3431 | ||
| 798 | 19년 전 | 4204 | ||
| 797 | 19년 전 | 4057 | ||
| 796 |
|
19년 전 | 1892 | |
| 795 |
|
19년 전 | 1847 | |
| 794 | 19년 전 | 4274 | ||
| 793 | 19년 전 | 2667 | ||
| 792 | 19년 전 | 2542 | ||
| 791 | 19년 전 | 2392 | ||
| 790 | 19년 전 | 1970 | ||
| 789 | 19년 전 | 2587 | ||
| 788 | 19년 전 | 2202 | ||
| 787 | 19년 전 | 1844 | ||
| 786 | 19년 전 | 1971 | ||
| 785 | 19년 전 | 1441 | ||
| 784 |
|
19년 전 | 1693 | |
| 783 | 19년 전 | 2835 | ||
| 782 |
|
19년 전 | 1953 | |
| 781 | 19년 전 | 3243 | ||
| 780 | 19년 전 | 3153 | ||
| 779 |
|
19년 전 | 2241 | |
| 778 |
|
19년 전 | 1794 | |
| 777 | 19년 전 | 2835 | ||
| 776 | 19년 전 | 2897 | ||
| 775 | 19년 전 | 4016 | ||
| 774 |
|
19년 전 | 1973 | |
| 773 | 19년 전 | 2620 | ||
| 772 | 19년 전 | 2337 | ||
| 771 | 19년 전 | 3468 | ||
| 770 |
|
19년 전 | 1430 | |
| 769 | 19년 전 | 1492 | ||
| 768 | 19년 전 | 1767 | ||
| 767 | 19년 전 | 2202 | ||
| 766 | 19년 전 | 1832 | ||
| 765 | 19년 전 | 1693 | ||
| 764 |
|
19년 전 | 2105 | |
| 763 |
|
19년 전 | 2214 | |
| 762 |
|
19년 전 | 4963 | |
| 761 | 19년 전 | 2326 | ||
| 760 |
|
19년 전 | 3191 | |
| 759 | 19년 전 | 2640 | ||
| 758 |
|
19년 전 | 2405 | |
| 757 | 19년 전 | 4697 | ||
| 756 | 19년 전 | 2560 | ||
| 755 |
|
19년 전 | 2412 | |
| 754 |
|
19년 전 | 1948 | |
| 753 |
|
19년 전 | 1730 | |
| 752 |
pearly
|
19년 전 | 3367 | |
| 751 | 19년 전 | 2340 | ||
| 750 |
|
19년 전 | 6156 | |
| 749 | 19년 전 | 2022 | ||
| 748 |
|
19년 전 | 1898 | |
| 747 |
|
19년 전 | 2704 | |
| 746 |
|
19년 전 | 1810 | |
| 745 | 19년 전 | 2279 | ||
| 744 | 19년 전 | 2110 | ||
| 743 |
|
19년 전 | 3562 | |
| 742 | 19년 전 | 2578 | ||
| 741 | 19년 전 | 2743 | ||
| 740 |
|
19년 전 | 4364 | |
| 739 | 19년 전 | 3546 | ||
| 738 |
|
19년 전 | 2305 | |
| 737 | 19년 전 | 4304 | ||
| 736 | 19년 전 | 3266 | ||
| 735 |
홀로남은자
|
19년 전 | 4134 | |
| 734 |
홀로남은자
|
19년 전 | 2020 | |
| 733 |
홀로남은자
|
19년 전 | 2227 | |
| 732 | 19년 전 | 2139 | ||
| 731 | 19년 전 | 3352 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기