미채택 완료

파일 다운로드가 안되는데요 잘아시는분 계실까요??

Copy
<?php
            if($file_name) {
                $file_path = "./data/".$id."/".$file_copied;
                $file_size = filesize($file_path);

                echo "▷ 첨부파일 : $file_name ($file_size Byte) &nbsp;&nbsp;&nbsp;&nbsp;
                       <a href='download.php?num=$num&id=$id&file_copied=$file_copied&file_name=$file_name&file_type=$file_type'>[저장]</a><br><br>";
            }    
            echo $content;     // 글 내용 출력
        ?>

다운로드파일

    $id = $_GET["id"];
    $file_copied = $_GET["file_copied"];
    $file_name = $_GET["file_name"];
    $file_type = $_GET["file_type"];
    $file_path = "./data/".$id."/".$file_copied;

    if(file_exists($file_path)) {
        header("Content-Type: application/octet-stream");
        header('Content-Description: File Transfer');
        header("Content-Disposition: attachment; filename=$file_name");
        header("Content-Transfer-Encoding:binary");
        header("Cache-Control:cache,must-revalidate");
        header("Pragma: public");
        header("Content-Length: " . filesize($file_path));
        flush();
        readfile($file_path);
        die();
    }

|

답변을 작성하려면 로그인이 필요합니다.