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.';
}
?>
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.';
}
?>