Hello.
I have a page in which I want to offer downloadable PDF files, but I don't know how to make it directly downloadable, instead of opening in browser on mouse click. I don't want it to open in browser because my advisor doesn't want to (enough reason, lol).
Is there any way to make it work? Javascript code, maybe?
Thanks in advance
Download PDF instead of opening in browser
Page 1 of 17 Replies - 2643 Views - Last Post: 27 February 2011 - 02:16 AM
Replies To: Download PDF instead of opening in browser
#2
Re: Download PDF instead of opening in browser
Posted 09 December 2010 - 11:38 AM
nope. you have to use the correct HTTP header. I think it was the Content-Disposition header.
#3
Re: Download PDF instead of opening in browser
Posted 22 December 2010 - 09:18 AM
Thanks for your answer, but it didn't work. I have added a header but still it doesn't pop up a download dialog, perhaps because it's in a different directory? Look how it's set:
<meta http-equiv="Content-Disposition" content="attachment; filename=Valores_Humanos_no_Desenvolvimento_Econômico.pdf"> ... <a href="Trabalhos/Valores_Humanos_no_Desenvolvimento_Econômico.pdf" target="_blank" >Valores humanos no desenvolvimento econômico</a>
#4
Re: Download PDF instead of opening in browser
Posted 22 December 2010 - 09:23 AM
I don’t mean the content-disposition header in HTML, I meant the HTTP header. you would have to add that through the server, e.g. on Apache you would have to change the server configuration (i.e. use the .htaccess file)
something along the lines of
something along the lines of
<IfModule mod_headers.c>
<FilesMatch "\.pdf$">
Header set Content-Disposition "attachment"
</FilesMatch>
</IfModule>
This post has been edited by Dormilich: 22 December 2010 - 09:39 AM
#5
Re: Download PDF instead of opening in browser
Posted 22 December 2010 - 09:33 AM
Ah, ok. Thanks again
So, I don't know if it's an Apache-based server (in fact, I know nothing about the server). Is there any way to know how can I configure it without making contact with the server administration (they are probably in vacation right now)?
So, I don't know if it's an Apache-based server (in fact, I know nothing about the server). Is there any way to know how can I configure it without making contact with the server administration (they are probably in vacation right now)?
#6
Re: Download PDF instead of opening in browser
Posted 22 December 2010 - 09:36 AM
you can simply look in the output of phpinfo(). the server version must be listed somewhere.
This post has been edited by Dormilich: 22 December 2010 - 09:37 AM
#7
Re: Download PDF instead of opening in browser
Posted 22 December 2010 - 10:37 AM
It's an Apache server. I have tried uploading an .htaccess file but it doesn't seem to work. I am sorry if I'm sounding dumb, but my experience with .htaccess and server configuration is really limited.
Adobe still opens the file in browser.
Thanks for your reply (again).
Adobe still opens the file in browser.
Thanks for your reply (again).
#8 Guest_Naveen*
Re: Download PDF instead of opening in browser
Posted 27 February 2011 - 02:16 AM
Thank you, thank you so much, this worked for me.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|