Hi,
When retrieving a pdf attachment on our DokuWiki, there's the classical prompt for opening or downloading file.
When using IE (5.50, but I believe other versions should cause problems), and selecting the "open" choice, the reader fails with "empty file". There's no problem when downloading the file and with other browsers (mozilla and firefox tested).
I think it's an IE bug with the Content-Type: "attachment header", debug and links point it *.
Briefly, I think simple code talks better : this patch workds fine :
------------------------------------------------------------------------------------------------
--- fetch.orig.php 2005-06-09 19:01:11.000000000 +0200
+++ fetch.php 2005-06-09 19:25:03.000000000 +0200
@@ -76,7 +76,11 @@
//application mime type is downloadable
if(substr($MIME,0,11) == 'application'){
- header('Content-Disposition: attachment; filename="'.basename($FILE).'"');
+ if(($EXT == 'pdf') && (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE"))){
+ header('Content-Disposition: filename="'.basename($FILE).'"');
+ }else{
+ header('Content-Disposition: attachment; filename="'.basename($FILE).'"');
+ }
}
$fp = @fopen($FILE,"rb");
------------------------------------------------------------------------------------------------
* here are some links :
http://lists.nyphp.org/pipermail/talk/2003-September/005058.html
http://www.zend.com/zend/tut/tutorial-PDFgen1.php?article=tutorial-PDFgen1&kind=t&id=4120&open=1&anc=0&view=1
http://aspn.activestate.com/ASPN/Mail/Message/php-france/2099996
Best regards,
Laurent STEFF