日期:2014-05-17 浏览次数:20428 次
<?php
$file_name=$_REQUEST['name'];
$file_name=iconv("utf-8","gb2312",$file_name);
$file_dir="./download/";
if(!file_exists($file_dir.$file_name))
{
echo "文件找不到!";
exit;
}
else
{
header("Content-Type:text/plain");
header("Accept-Ranges:bytes");
header("Content-Disposition:attachment;filename=".$file_name);
$file=fopen($file_dir.$file_name,"r");
echo fread($file,filesize($file_dir.$file_name));
fclose($file);
$num=file_get_contents("./num.dat");
$num=(int)($num)+1;
file_put_contents("./num.dat",$num);
exit;
}
?>