Re: downloading files
| From: | Carlos Fernando Scheidecker Antunes | Date: | Mon, 11 Dec 2000 18:01:57 +0000 |
| Subject: | Re: downloading files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29722@lists.php.net to get a copy of this message | ||
Ignacio,
How can I use the readfile() function to dump the file to the client?
Thank you,
Carlos Fernando Scheidecker Antunes.
On Mon, 11 Dec 2000, Deepak Chawla wrote:
> Hi!
> is there a way in which i can allow users to download files from my site
> without letting them know the location on the file on my server ?? i'm
> using html+javascript on the client side and php on the server side.
>
> thanks
>
> -deepak
>
Just use a database or array to hold a map, e.g.:
file1.txt => (/docs/text/file1, text/plain)
file2.pdf => (/docs/file2.pdf, application/x-pdf)
...
Then use header() to set the content type and readfile() to dump the file
passed as a GET parameter (e.g.,
http://www.example.com/file.php3?file=file1.txt).
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>
--
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