PDA

View Full Version : download pdf



BubikolRamios
Mar 21st, 2009, 04:37 PM
this automaticaly opens pdf in browser window, how to force it to auto open download box ?


<a href = "../downloadable_files/test.pdf">click here</a>

abduraooft
Mar 21st, 2009, 05:39 PM
Add
AddType application/octet-stream .pdf .PDF into your .htaccess file.

ubh
Mar 21st, 2009, 07:58 PM
Interesting, never knew this. Thanks.

abduraooft, is there any other special configuration I would need to perform on my Apache web server for this to work, or is it standard out of the box stuff?

BubikolRamios
Apr 3rd, 2009, 05:38 AM
was reading somewhere that use of htacc... files is inefficient.

So puted this into web.xml



<mime-mapping>
<extension>pdf</extension>
<mime-type>application/octet-stream</mime-type>
</mime-mapping>


and it works, for all pdf-s ewerywhere doh, which is what I dont want obviously.

I presume something like this should be in server.xml, including path to specific dir, Any tips for that ?

BubikolRamios
Apr 3rd, 2009, 12:11 PM
putting ths in server.xml is ok



<Directory />
<extension>pdf</extension>
<mime-type>application/octet-stream</mime-type>
</Directory>


hmm, what is wrong here ? puting anything behind / causes this



<Directory /web...> <extension>pdf</extension>
<mime-type>application/octet-stream</mime-type>
</Directory>


-->org.xml.sax.SAXParseException: Element type "Directory" must be followed by either attribute specifications, ">" or "/>".