2011-10-07 106 views
0

我有IE8一如既往的问题。它不会下载我通过脚本上传到服务器的rtf文件。它在数据库中保存正确Internet Explorer无法下载RTF文件中的PHP应用程序

我的下载脚本是在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; 

这是给错误:

enter image description here

+0

,你已经证明我们的代码中没有显示的上传机制。您是否尝试过输出代码正在查找的确切URL,并确保文件存在于该URL - 而不仅仅是数据库中的参考? – Luke

+0

@BrendanBullen请参阅我的屏幕截图atached –

+0

@Coulton文件保存数据库中正确此错误只给到RTF文件和IE唯一的其他所有文件类型和做工精细 –

回答

1

你可以尝试强制下载:

header("Content-Type: application/force-download"); 

注意;你应该考虑发送更多头文件:

header("Pragma: public"); 
header("Expires: 0"); 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
header("Cache-Control: private",false); 
header('Content-Description: File Transfer'); 
header("Content-Type: $type"); 
header('Content-Length: ' . filesize($file));   
header('Content-Disposition: attachment; filename=' . basename($file)); 
+0

如果文件不存在或URL错误,这不是任何用途。 – Luke

+1

是;但正如他所言。他有ie8问题。我认为它可以在其他浏览器中使用。 – MasterCassim

+0

完成工作感谢兄弟! –

-1

这不太可能是IE的问题。

输出$name到浏览器,并检查该网址正是导致你正在寻找您的服务器上的文件。

的是确切的网址您的域名?你可以用精确的URL例如尝试:http://website.com/file.rtf

+0

文件是存在的和Firefox/Chrome浏览器下载该文件非常好 –

+0

@Roshan是URL'$ name'相对于你的网址或者是确切的? 'http:// website.com/file.rtf' – Luke

+1

问题是IE期间。如果你问我,最糟糕的网页浏览器。 –

相关问题