|
-
Nov 30th, 2007, 06:32 PM
#1
Thread Starter
Frenzied Member
Downloading Files
Hello!
Heres what I want, I have files on my server, for example 1.exe, 2.zip.
Through a PHP script I want to allow the user to download then but under a new name, for example 1.exe will be called Setup.exe and 2.zip would be Music.zip.
I want this to go through a PHP script to incrmement a download counter, to hide the original URL and to enforce permissions.
Thanks
-
Nov 30th, 2007, 07:06 PM
#2
Re: Downloading Files
well a redirect header would have the page start the download. Dont know if you can change the name. What if you just change the name on upload?
My usual boring signature: Something
-
Nov 30th, 2007, 07:11 PM
#3
Hyperactive Member
Re: Downloading Files
PHP Code:
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="setup.exe"');
readfile('example1.exe');
» Twitter: @rudi_visser : Website: www.rudiv.se «
If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.
-
Nov 30th, 2007, 07:18 PM
#4
Thread Starter
Frenzied Member
Re: Downloading Files
Thanks fellas Just what I needed
-
Dec 2nd, 2007, 07:36 AM
#5
Fanatic Member
Re: Downloading Files
 Originally Posted by RudiVisser
PHP Code:
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="setup.exe"');
readfile('example1.exe');
As long as you are careful to send no headers you can use this to record downloads with a text file or database connection. Put the counter increment code before that code and you are all set.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|