求帮看下这段PHP下载MP4文件的问题,文件下载不完整 phpmp4 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ob_clean(); flush(); readfile($file); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".$len);这俩删掉试试 $len = filesize($file);header("Content-Length: ".$len);上面2句删除后可以下载,但没统计文件大小,迅雷和IE没显示下载时长。 nginx + php 环境下 没有你说的那个问题,ie和迅雷都可以正常下载 不过我的文件是flv,这样的话也只能说明是mime头出错了我的代码如下:function dl_file($file){ $len = filesize($file); $filename = basename($file); $file_extension = strtolower(substr(strrchr($filename,"."),1)); switch( $file_extension ) { case "mp4": $ctype="video/mp4"; break; default: $ctype="application/force-download"; } header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: $ctype"); $header="Content-Disposition: attachment; filename=".$filename.""; header($header ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".$len); ob_clean(); flush(); readfile($file); exit;}dl_file('http://res.805.com/videos/霍山·上林后苑(易仟亿集团) [640x480].flv'); 只改了一个文件名而已 其他的都没变 没测试过 应该有吧 有"Content-Length头的 博客看看http://www.jb51.net/article/46440.htm 大家看下这样一个网站报价跟工期是多少? 如何获取文件的修改权限? php 5.2.6以下版本round精度问题 求 apache 重写规则 php代码禁止搜索引擎蜘蛛 think html:list 的datasource 救急? 本人新手,问一个php+mysql删除数据问题 100分悬赏 ,有没有PHP的入门书籍 thinkPHP无法加载数据库驱动PDO 为什么域名访问这么慢。wordpress Php(欢)攻(迎)城(推)师(荐)!!!!
flush();
readfile($file);
header("Content-Length: ".$len);
这俩删掉试试
$len = filesize($file);
header("Content-Length: ".$len);
上面2句删除后可以下载,但没统计文件大小,迅雷和IE没显示下载时长。
我的代码如下:function dl_file($file){
$len = filesize($file);
$filename = basename($file);
$file_extension = strtolower(substr(strrchr($filename,"."),1));
switch( $file_extension ) {
case "mp4": $ctype="video/mp4"; break;
default: $ctype="application/force-download";
}
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: $ctype");
$header="Content-Disposition: attachment; filename=".$filename."";
header($header );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".$len);
ob_clean();
flush();
readfile($file);
exit;
}
dl_file('http://res.805.com/videos/霍山·上林后苑(易仟亿集团) [640x480].flv'); 只改了一个文件名而已 其他的都没变
http://www.jb51.net/article/46440.htm