File Downloads

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
kev1952
-


Joined: 08 Sep 2005
Posts: 105
Location: Townsville Australia

PostPosted: Mon Jul 09, 2007 8:40 am    Post subject: File Downloads Reply with quote

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 View user's profile Send private message Send e-mail Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Jul 09, 2007 2:06 pm    Post subject: Re: File Downloads Reply with quote

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 View user's profile Send private message Send e-mail
kev1952
-


Joined: 08 Sep 2005
Posts: 105
Location: Townsville Australia

PostPosted: Mon Jul 09, 2007 7:09 pm    Post subject: Reply with quote

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 View user's profile Send private message Send e-mail Visit poster's website
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Mon Jul 09, 2007 7:14 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
kev1952
-


Joined: 08 Sep 2005
Posts: 105
Location: Townsville Australia

PostPosted: Tue Jul 10, 2007 12:42 am    Post subject: Reply with quote

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 View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group