求帮看下这段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求一等式,由于本人比较菜。 HTTP协议 php redis问题 BUTTON 按钮 即可以事件也可以超连接 如果有请写出看 看 谢谢 在线等 求php无线分类 大家看看我的语法哪里有问题,输不出来数据。 急!!!pop服务器怎么分离邮件主体和附件 我刚刚搭建了个centos6.0平台有问题! 织梦list列表下利用自定义函数判断然后输出不同的样式? 为什么域名访问这么慢。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