무조건 링크건 화일 다운받기
링크걸면 다운이 안되거나 이상한 이름으로 변경되어 다운되는 경우가 있는데
이걸 해보려고 이리저리 돌아다니고 시간도 많이 잡아 먹었네요.
혹시 저처럼 헤메시는 분 있을까봐 소스 올려드려요.
제가 해본것은 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년 전 | 2724 | |
| 729 |
그레이스웹
|
19년 전 | 3515 | |
| 728 |
|
19년 전 | 2688 | |
| 727 |
|
19년 전 | 2526 | |
| 726 |
|
19년 전 | 2344 | |
| 725 |
|
19년 전 | 2247 | |
| 724 |
|
19년 전 | 2135 | |
| 723 |
|
19년 전 | 4256 | |
| 722 |
|
19년 전 | 2670 | |
| 721 |
|
19년 전 | 2166 | |
| 720 |
|
19년 전 | 2262 | |
| 719 |
|
19년 전 | 2849 | |
| 718 |
|
19년 전 | 1962 | |
| 717 |
|
19년 전 | 3197 | |
| 716 |
|
19년 전 | 2753 | |
| 715 |
|
19년 전 | 2270 | |
| 714 |
|
19년 전 | 1821 | |
| 713 |
|
19년 전 | 2238 | |
| 712 |
|
19년 전 | 2011 | |
| 711 |
|
19년 전 | 1907 | |
| 710 |
|
19년 전 | 2468 | |
| 709 |
|
19년 전 | 2330 | |
| 708 |
|
19년 전 | 3891 | |
| 707 |
|
19년 전 | 3740 | |
| 706 |
|
19년 전 | 2237 | |
| 705 |
|
19년 전 | 3300 | |
| 704 |
|
19년 전 | 1968 | |
| 703 |
|
19년 전 | 2383 | |
| 702 |
|
19년 전 | 2280 | |
| 701 |
홀로남은자
|
19년 전 | 2347 | |
| 700 |
홀로남은자
|
19년 전 | 2181 | |
| 699 | 19년 전 | 2816 | ||
| 698 |
|
19년 전 | 2840 | |
| 697 |
|
19년 전 | 3171 | |
| 696 |
|
19년 전 | 3046 | |
| 695 |
|
19년 전 | 2707 | |
| 694 |
|
19년 전 | 2937 | |
| 693 |
|
19년 전 | 3190 | |
| 692 |
|
19년 전 | 2880 | |
| 691 |
|
19년 전 | 2628 | |
| 690 | 19년 전 | 2929 | ||
| 689 | 19년 전 | 4510 | ||
| 688 | 19년 전 | 2438 | ||
| 687 | 19년 전 | 2450 | ||
| 686 | 19년 전 | 3477 | ||
| 685 | 19년 전 | 3165 | ||
| 684 | 19년 전 | 2823 | ||
| 683 | 19년 전 | 2058 | ||
| 682 | 19년 전 | 1776 | ||
| 681 | 19년 전 | 2876 | ||
| 680 | 19년 전 | 1721 | ||
| 679 | 19년 전 | 2311 | ||
| 678 | 19년 전 | 3961 | ||
| 677 | 19년 전 | 3737 | ||
| 676 | 19년 전 | 3464 | ||
| 675 | 19년 전 | 3408 | ||
| 674 |
|
19년 전 | 1567 | |
| 673 |
|
19년 전 | 1939 | |
| 672 |
|
19년 전 | 1861 | |
| 671 | 19년 전 | 2525 | ||
| 670 | 19년 전 | 4625 | ||
| 669 |
|
19년 전 | 2764 | |
| 668 |
|
19년 전 | 1924 | |
| 667 |
|
19년 전 | 1936 | |
| 666 |
|
19년 전 | 1838 | |
| 665 |
|
19년 전 | 2569 | |
| 664 |
|
19년 전 | 8176 | |
| 663 |
|
19년 전 | 2729 | |
| 662 |
|
19년 전 | 2790 | |
| 661 |
|
19년 전 | 3045 | |
| 660 |
|
19년 전 | 2208 | |
| 659 |
|
19년 전 | 2219 | |
| 658 |
|
19년 전 | 2172 | |
| 657 |
|
19년 전 | 2082 | |
| 656 |
|
19년 전 | 2268 | |
| 655 |
|
19년 전 | 2527 | |
| 654 |
|
19년 전 | 3079 | |
| 653 | 19년 전 | 2331 | ||
| 652 | 19년 전 | 1916 | ||
| 651 |
|
19년 전 | 2838 | |
| 650 | 19년 전 | 5006 | ||
| 649 | 19년 전 | 3501 | ||
| 648 | 19년 전 | 3459 | ||
| 647 | 19년 전 | 2973 | ||
| 646 | 19년 전 | 2401 | ||
| 645 | 19년 전 | 1495 | ||
| 644 | 19년 전 | 3137 | ||
| 643 | 19년 전 | 2017 | ||
| 642 |
|
19년 전 | 5390 | |
| 641 | 19년 전 | 2434 | ||
| 640 | 19년 전 | 3432 | ||
| 639 | 19년 전 | 2862 | ||
| 638 | 19년 전 | 1765 | ||
| 637 | 19년 전 | 3880 | ||
| 636 | 19년 전 | 2426 | ||
| 635 | 19년 전 | 2318 | ||
| 634 |
|
19년 전 | 3025 | |
| 633 |
|
19년 전 | 3303 | |
| 632 | 19년 전 | 2502 | ||
| 631 | 19년 전 | 2264 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기