View previous topic :: View next topic |
Author |
Message |
kev1952 -
Joined: 08 Sep 2005 Posts: 105 Location: Townsville Australia
|
Posted: Thu Mar 02, 2006 12:22 pm Post subject: File Downloads |
|
|
I have searched here and the PHP manual but haven't found what I want. I would like to be able to create a script that will control downloads (as in automatically start a download). I just need a hint about what functions are used to send a file - I want to create the script myself but just need a starting point. _________________ Cheers.... Kev
Kev's Place - http://www.kevsplace.com
Powered by Abyss X1. |
|
Back to top |
|
 |
dynaweb -
Joined: 30 Apr 2003 Posts: 4
|
|
Back to top |
|
 |
kev1952 -
Joined: 08 Sep 2005 Posts: 105 Location: Townsville Australia
|
Posted: Thu Mar 02, 2006 7:37 pm Post subject: |
|
|
Sorry - I want to have a user click on a file download link that takes him/her to another page that that can have anything on it. On that page would also be a "file download will start shortly - if not click here" type message. The file download would then begin. Somwthing similar to using a meta refresh in HTML. _________________ Cheers.... Kev
Kev's Place - http://www.kevsplace.com
Powered by Abyss X1. |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Thu Mar 02, 2006 8:01 pm Post subject: |
|
|
You could make a php file that uses download.php?file=whatever.zip and then it displays the information for that file. Im sure there is a php script out there to do it or it shouldnt be too hard to make a custom one. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Thu Mar 02, 2006 8:01 pm Post subject: |
|
|
Why not just use a meta refresh then?
I don't see what's so hard about this.
Edit: Timing! _________________
 |
|
Back to top |
 |
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Thu Mar 02, 2006 8:06 pm Post subject: |
|
|
Very good timing!
The problem with a meta refresh is that there would have to be a seperate page for each file. With the PHP script there is one page and the file is passed through a form on the previous page to the file= part of the script. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Thu Mar 02, 2006 8:10 pm Post subject: |
|
|
I see.
Why not something as simple as:
Code: | <?php
if (!file_exists("files/".$_SERVER['QUERY_STRING']))
echo "No such file.";
else
echo "<a href='files/".$_SERVER['QUERY_STRING']."'>Download</a>, etc. etc.";
?> |
And link to download.php?whatever.zip and put whatever.zip in files/? _________________
 |
|
Back to top |
 |
 |
kev1952 -
Joined: 08 Sep 2005 Posts: 105 Location: Townsville Australia
|
Posted: Thu Mar 02, 2006 8:35 pm Post subject: |
|
|
MN - I know how to get to the file (similar to what you have posted above) but the info I want is how to get PHP to actually send the file. I could use the META refresh method (from PHP) but I would like a more elegant way of doing it. _________________ Cheers.... Kev
Kev's Place - http://www.kevsplace.com
Powered by Abyss X1. |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Thu Mar 02, 2006 8:42 pm Post subject: |
|
|
PHP doesnt send files, the web server does. PHP simply points the browser to the location of the file. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
|
Back to top |
 |
 |
|