php-下载

<?php
header('Cache-Control: private');
$file="c:/test/".$_GET['dl'];
if (isset($_REQUEST['dl']) && file_exists($file) )
    {
     header('Content-Type: application/octet-stream');
     header("Content-Length: ".filesize($file));
    header('Content-Disposition: attachment; filename="复件.txt"');
    header('Content-Transfer-Encoding: binary');
    readfile($file);

    }
else
    {
    echo 'No file with this name for download.';
    }


?>
posted @ 2008-08-12 10:58  混混的IT生涯  阅读(132)  评论(0编辑  收藏  举报