RE: [PHP] Download File Routine
| From: | Krznaric Michael | Date: | Wed, 22 Nov 2000 16:18:28 +0000 |
| Subject: | RE: [PHP] Download File Routine | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-26655@lists.php.net to get a copy of this message | ||
Well I can think of a solution. Call your script like
www.yoursite.com/script/path/to/file/filename
where script is the name of your php script and make sure that /path/to/file
is outside your web tree.
Then in your PHP script you can parse $PATH_INFO (which in this case will be
something like /path/to/file/filename) and fetch and send the file to the
user. This way the user can only get the file while going through your
script.
With respect to making the user go through the authentification page first,
you should store a list of authentificated users/ip's somewhere (DB/file)
and before you send the file to the user in the above example, make you that
you authenticated him in your login script.
Mike
-----Original Message-----
From: GMansky [mailto:gmansky@starcafe.com]
Sent: Wednesday, November 22, 2000 11:10 AM
To: php-general@lists.php.net
Subject: [PHP] Download File Routine
I have a simple form to validate a user with a password which then brings up
another page that show the file that can be downloaded.
I have the name of the file hyperlinked. However, that will reveal the
specific location of the file to be downloaded.
How can I do it so that ...
1. even if the location of the file is known, it can not be downloaded
without having gone through the authentication page
2. through a function, download the file.
Thanks in advance
George
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net