This is a discussion on "Download button - to download a PDF file" within the Web Page Design section. This forum, and the thread "Download button - to download a PDF file are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
Download button - to download a PDF file
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Download button - to download a PDF file
Hello,
I need to offer some pdf download options on my site. Pointing to the .pdf file only opens it. I would like a "download" button with the options where to download the file instead of opening it. Is there a HTML code for that? Can anyone help? Thanks Attila |
|
|
|
||||
|
Re: Download button - to download a PDF file
You have to options.
1. Tell users to right click the link and click save as. 2. Use PHP headers to give a download prompt. The first would be easier, but the second is more professional. Does your server support PHP?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|||
|
Re: Download button - to download a PDF file
Thanks!
I would prefer the professional option... However: My server does support PHP... but I dont... I mean, I never used it. If there is a simple code I can insert on the pages what I would like to direct the visitor back, that would be great ! I guess the page name needs to be stored somehow, and to be able to call back later... But... how? |
|
||||
|
Re: Download button - to download a PDF file
Very simple, in fact it's the example on the PHP manual.
Save the following as download.php
You can also change download.pdf in the following to the name you want the user to download the file as: filename="downloaded.pdf" and then use the following to offer a download:
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|||
|
Re: Download button - to download a PDF file
Hello, just came across this thread and I think it's the code I need...
Am trying to do the same thing with an mp3... Could anyone confirm I am doing this right? So far I have made a file called download.php that looks like this: <?php // We'll be outputting an mp3 header('Content-type: application/mp3'); // It will be called shoveit.mp3 header('Content-Disposition: attachment; filename="shoveit.mp3"'); // The PDF source is in shoveit.mp3 readfile('http://www.smiledownuponus.org/audio/shoveit.mp3'); ?> and then I made an image map link on the page looking like this: <area alt="download" href="http://www.smiledownuponus.org/download.php" shape="rect" coords="228, 416, 383, 446"> Seems not to work - when you click on it, it just says I am trying to access a forbidden document. HELP! |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Allow users to download flv file | @lun | Flash & Multimedia Forum | 4 | Jan 29th, 2008 17:33 |
| file download help | acrikey | Web Page Design | 7 | Aug 23rd, 2007 00:11 |
| Download button | sabatier | PHP Forum | 2 | Aug 13th, 2007 14:30 |
| File Download | nileshnaik | JavaScript Forum | 1 | Nov 27th, 2006 16:13 |
| Text file download | harlekin | Classic ASP | 2 | Dec 5th, 2005 18:23 |