Download (pdf /avi) file from Web page

He has: 13 posts

Joined: Sep 2006

I have looked without success on Google for a solution.

I have a pdf ("Document1.pdf") and an avi ("production.avi") files stored in a folder called ("downloads") on my web site.

What i need to know is how to let people download the files through a link on my website. My website is XHTML strict and am using CSS level2.

I want to keep everything validated too.

Please could someone point me to a tutorial etc on how to do it - assuming i need to use PHP or Javascript then my host does support these.

Thanks in advance for any help.

calculator's picture

They have: 40 posts

Joined: Nov 2007

Hi Jako,

If you you want these to download why not zip them up and link to them. A zip file default behaviour is download not 'open using browser'. By zipping them up you would please your visitors as well because it might reduce the file size.

Alternativelly if zipping the files is not an option you can always use the following tutorial: http://www.stuvel.eu/pdfdownload. It shows how to do it using .htaccess or php (at the bottom of the tutorial)

You might need to check with your host which solution they recommend.

He has: 13 posts

Joined: Sep 2006

Many thanks for your reply and the link.

Much appreciated.

They have: 166 posts

Joined: Mar 2006

Zip them both up, (seperatly, together, w/e) and link to them as you would linking to another webpage within your website. They will download on click. There is no easier way.

The pdf will reduce in size, the avi will not. But all you want is to get it downloaded for access correct? If you don't want the user to have to download zip program as well, you could always use the executable function which doesn't need winrar or zip to extract.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.