Force File download, do not display/open in browser

This section contains help & material related to web development.

Force File download, do not display/open in browser

Postby MT Shahzad on March 18th, 2008, 5:48 am

In your HTML directly link to the file.. <a href="/files/test.pdf">Download Pdf</a>. Now you will get a pop-up box asking whether you want to save the file or open it.

Place the following code into your .htaccess file.

Code: Select all
AddType application/octet-stream .pdf
AddType application/octet-stream .doc
AddType application/octet-stream .csv
MT Shahzad
Web/Software Developer
http://mts.sw3solutions.com
User avatar
MT Shahzad
Site Admin
 
Posts: 300
Joined: February 29th, 2008, 8:11 am
Location: Muridke, Pakistan

Return to Miscellaneous

Who is online

Users browsing this forum: No registered users and 0 guests

cron