View previous topic :: View next topic |
Author |
Message |
kev1952 -
Joined: 08 Sep 2005 Posts: 105 Location: Townsville Australia
|
Posted: Mon Jul 09, 2007 8:40 am Post subject: File Downloads |
|
|
I'm trying to get my website to display a page when a file download is initiated - for instance, the user clicks a file link and instead of the file being sent immediately a new page opens and they get a message like "If your download does not start automatically....." etc. I have tried a few things but just can't seem to get it right. I have experimented with META tags (they work but not very satisfactorily) and a few PHP commands that don't do as I want.
All ideas would be appreciated. _________________ Cheers.... Kev
Kev's Place - http://www.kevsplace.com
Powered by Abyss X1. |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Jul 09, 2007 2:06 pm Post subject: Re: File Downloads |
|
|
kev1952,
This is done using the refresh meta tag.
Here is an example:
Code: | <HTML>
<HEAD>
<TITLE>Downloading file.dat</TITLE>
<META http-equiv="refresh" content="5;/file.dat">
</HEAD>
<BODY>
<P>If the download does not start in 5 seconds, click <A HREF="/file.dat">here</A>.</P>
</BODY>
</HTML> |
_________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
kev1952 -
Joined: 08 Sep 2005 Posts: 105 Location: Townsville Australia
|
Posted: Mon Jul 09, 2007 7:09 pm Post subject: |
|
|
Thanks for the reply. I did try that and it does work but it then requires me to specify a filename in the code for each download. Is there a way to pass the filename to a PHP script? I use PHP exclusively on my website and am starting to get fairly good at it but need help with this one. _________________ Cheers.... Kev
Kev's Place - http://www.kevsplace.com
Powered by Abyss X1. |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Mon Jul 09, 2007 7:14 pm Post subject: |
|
|
kev1952 wrote: | Thanks for the reply. I did try that and it does work but it then requires me to specify a filename in the code for each download. Is there a way to pass the filename to a PHP script? I use PHP exclusively on my website and am starting to get fairly good at it but need help with this one. |
Simply put
<META http-equiv="refresh" content="5;/<?php echo($filename); ?>">
and that should pass the $filename variable into the METATAG and allowing the page to know which file to use. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
kev1952 -
Joined: 08 Sep 2005 Posts: 105 Location: Townsville Australia
|
Posted: Tue Jul 10, 2007 12:42 am Post subject: |
|
|
Thanks to both of you - I now have it working. I had a couple of logic errors in the code and have now fixed them. Will tidy it all up to match the site and it will be good to go. _________________ Cheers.... Kev
Kev's Place - http://www.kevsplace.com
Powered by Abyss X1. |
|
Back to top |
|
 |
|