View pdf in browser but save with wrong file name
Asked Answered
A

3

7

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: application/pdf");
header("Content-Disposition: inline; filename=$pdfFileName");

Thanks!

Accede answered 29/3, 2011 at 20:21 Comment(1)
sounds like a bug in the adobe pluginScreamer
W
2

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

Woodworth answered 30/3, 2011 at 8:0 Comment(2)
I think I've tried all of that and still nothing :l thanks thoughAccede
@Fabrizio Accatino, you clearly state that IE build from itself the file name when you save it thought Acrobat PDF plugin preview. Still same behavior with IE 11 !Smarm
R
0

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

Reformatory answered 30/3, 2011 at 4:57 Comment(1)
I wan't it to open in the browser using the adobe plugin. Won't this remove that?Accede
N
0

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

ex:

get_file.php/Myfilename.pdf
Nordstrom answered 29/5, 2018 at 15:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.