开发者

View pdf in browser but save with wrong file name

I have a form where when a user presses the download button it a get_file.php script returns the specified php file. In ffx when I disable the adobe plugin, a download box appears with the correct file name. In IE8 I cant disable the adobe plugin for some reason, so it always opens in browser. This works fine, however, in both ffx and IE8, when I press the save button from the adobe toolbar I get the wrong file name. I get get_file.pdf.

I am using adobe reader 8.

These are the headers I'm setting:

header("Cache-Control: private");
header("Pragma:");
header("Content-type: applicatio开发者_开发技巧n/pdf");
header("Content-Disposition: inline; filename=$pdfFileName");

Thanks!


Setting tha pdf filename is quite complex. It dependeds what are you needs/environment.
Sometime ago I wrote a small doc about the topic. Hope it could be useful for you.
https://docs.google.com/View?docid=dchmct9k_9dxkdwk


Instead of "Content-Disposition: inline;, try "Content-Disposition: attachment;.


Just add the filename to end of URL, it works fine for me

ex:

get_file.php/Myfilename.pdf
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜