<?php
function file_down($file_name){
$file_file="./down/".$file_name;
//echo $file_file;
$file_name=iconv("UTF-8","GB2312",$file_name);
if(!file_exists($file_file)){
echo "文件不存在!";
return;
}else{
$fp=fopen($file_file,"r");
$fs=filesize($file_file);
}
header("Content-type: application/octet-stream");
header("Accept-Ranges: bytes");
header("Accept-Length:".$fs);
header("Content-Disposition: attachment; filename=".$file_name);
$fss=1024;
$file_content=0;
while($fs-$file_content>0){
$file_data=fread($fp,$fss);
$file_content+=$fss;
echo $file_data;
}
fclose($fp);
}
file_down("456.wmv");
?>