Solved

Creating a downloadable link on my website

Posted on 2008-10-14
5
228 Views
Last Modified: 2012-05-05
I have a fillable PDF file that I would like to offer as a download on my website...I need to create a link that when clicked will prompt the user to download the file.
0
Comment
Question by:felkamau
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22711123
JUst do this
<a href="http://domainname/filename.pfd">Download Me</a>
0
 

Author Comment

by:felkamau
ID: 22716714
this only opens the pdf...I need to force a download
0
 
LVL 36

Assisted Solution

by:Loganathan Natarajan
Loganathan Natarajan earned 100 total points
ID: 22717956
do you use any SERVER Side scripting in your website?  like PHP/ASP/JSP etc.,?
0
 
LVL 3

Assisted Solution

by:dipakdave1983
dipakdave1983 earned 100 total points
ID: 22718512
Well, you have to explicitely set Header to download using appropriate syntex of your webpage.

Content-Type: application/force-download

So Trick is 1) read entire file as .bin 2) clear the response stream ( it will clear some default contents such as <html contenttype.....>3) set content type as above into HEADER  and  inject .bin file contents to output

example for PHP :
header("Content-type: application/force-download");
header("Content-Disposition: attachment; filename=\"".basename($file)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($file));
readfile("$file");

0
 

Accepted Solution

by:
felkamau earned 0 total points
ID: 23045039
I saved it as a zip file...problem solved
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
This video teaches users how to migrate an existing Wordpress website to a new domain.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question