php 파일 다운로드, php file download > Web 끄적임

본문 바로가기
사이트 내 전체검색

Web 끄적임

PHP php 파일 다운로드, php file download

페이지 정보

profile_image
작성자 관리자
댓글 0건 조회 8,911회 작성일 22-01-10 17:23

본문


#### (1)
if (file_exists($file_path)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="'.urlencode(basename($file_name)).'"');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file_path));
    readfile($file_path);
    exit;
}


#### (2)

if (file_exists($file_path)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header("Content-Type: application/force-download");
    header('Content-Disposition: attachment; filename="'.urlencode(basename($file_name)).'"');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file_path));
    ob_clean();
    flush();
    readfile($file_path);
    exit;
}

추천0 비추천0

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

접속자집계

오늘
1,010
어제
1,132
최대
2,110
전체
46,686
접속자 : 13 모바일버전

Copyright © NEION All rights reserved.