Apr 19

php - readfile IE无法下载 不指定

felix021 @ 2008-4-19 03:45 [IT » 网络] 评论(1) , 引用(0) , 阅读(12812) | Via 本站原创 | |
开始重写Felix的网络硬盘程序
用到这一段代码:
( /share/download.php?act=download&fid=3 )
header("Content-type: application/octet-stream");
header("Accept-Ranges: bytes");
header("Accept-Length: " . $file->size);
header("Content-Disposition: attachment; filename=".$file->filename);
readfile("files/" . $file->filepath);

发现如果是直接在浏览器地址栏里面输入这个地址,如果被迅雷等下载程序接管,那么可以正常下载;但是如果用IE下载,则出现错误提示:
Internet Explorer 无法下载 download.php?act=download&fid=3 来自 127.0.0.1。
Internet Explorer 无法打开该 Internet 站点。请求的站点不可用,或找不到。请以后再试。
想了好久,telnet 127.0.0.1 80
GET /share/download.php?act=download&fid=3
显示出的内容也正常,用filefox也正常,用IE右键另存为也正常。
无意中发现,把前面的ob_start()和session_start()注释掉以后就OK了,再进一步,发现只要注释掉session_start()就OK了。但是想不明白为什么。可是我还需要session,郁闷。看来暂时只能用cookie代替了。。。



欢迎扫码关注:




转载请注明出自 ,如是转载文则注明原出处,谢谢:)
RSS订阅地址: https://www.felix021.com/blog/feed.php
Tags: ,
ok大杂烩 Email Homepage
2009-8-28 10:50
这个问题我刚好的遇到了,我的解决办法是加charset
http://bbs.ok575.com/read.php?tid=317
felix021 回复于 2009-8-28 10:52
o。。谢谢:)
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   *非必须
网址   电邮   [注册]