Re: downloading files

From: Date: Mon, 11 Dec 2000 17:12:02 +0000
Subject: Re: downloading files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-29709@lists.php.net to get a copy of this message
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>

« previous php.general (#29709) next »