Internet Explorer 无法在 PHP 应用程序中下载 rtf 文件
我一如既往地遇到 ie8 问题。它不下载我通过脚本上传到服务器的 rtf 文件。它正确保存在数据库中
我的下载脚本是在 php 中
$outname = stripslashes($attachment[0]['dis_attach_content']);
$type = stripslashes($attachment[0]['dis_attach_type']);
$name = stripslashes($attachment[0]['dis_attach_name']);
header("Content-type:" . $type);
header('Content-disposition: attachment; filename=' . $name);
echo($outname);
exit;
这给出了错误:
I have a problem with ie8 As ALWAYS. its not downloading rtf files i uploaded to server by my script. its saving in the database correctly
My download script is in php
$outname = stripslashes($attachment[0]['dis_attach_content']);
$type = stripslashes($attachment[0]['dis_attach_type']);
$name = stripslashes($attachment[0]['dis_attach_name']);
header("Content-type:" . $type);
header('Content-disposition: attachment; filename=' . $name);
echo($outname);
exit;
This is giving the error:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以尝试强制下载:
注意;您应该考虑发送更多标头:
You can try to force the download:
Note; you should consider sending more headers:
将 Content-Disposition 标头设置为“attachment”,如下所示(在 PHP 中):附件是编写脚本的位置。
并在 .htaccess 中添加以下内容,并添加您想要下载的扩展名,而不仅仅是 rtf
Set the Content-Disposition header to "attachment", like so (in PHP): where attachment was scripted.
and add the following in .htaccess and add what ever extension that you want to download not only rtf
这不太可能是 IE 的问题。
将
$name
输出到浏览器,并检查该 URL 是否准确指向您在服务器上查找的文件。该 URL 是否与您的域完全一致?您可以使用确切的 URL 进行尝试,例如:
http://website.com/file.rtf
This is unlikely to be a problem with IE.
Output
$name
to the browser, and check that this URL leads exactly to the file you're looking for on your server.Is the URL exact to your domain? You could try it with the exact URL eg:
http://website.com/file.rtf