我已在 php 应用程序中附加了 Outlook 消息文件。我将该文件存储在 SQL Server 数据库中。
现在我想从浏览器打开并显示它。
我尝试了这段代码:
if($ext=="msg")
{
header('ContentType : application/octet-stream');
header('Content-Disposition: attachment; filename='. basename($filename));
echo base64_decode($file);
}
$filename 和 $file 来自数据库。
它可以从 IE 和 chrome 中打开 Outlook 中的 msg 文件,但无法从 Firefox 中打开。
有什么办法可以让它在所有浏览器中工作吗?
还是我哪里错了或者浏览器中有什么设置?
我遇到了几乎类似的情况并且能够解决它。
包含下面的标题,它应该可以正常工作。
Regards
header("Pragma: public");
header("Expires: 0");
header('Content-Encoding: UTF-8');
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-type: application/vnd.ms-outlook;charset=UTF-8");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=test.msg");
header("Content-Transfer-Encoding: binary ");
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)