You can put the files that need to be downloaded in a directory somewhere outside of the web server root, but in that case your PHP program will need to read the file and print it to the browser, and it will also need printing the HTTP headers:
Content-type: application/octet-stream Content-disposition: attachment; file=$filename Content-length: xxx [blank line] Or you can put the files somewhere on the web server tree, protect the directory with .htaccess (username + password), and just put a simple link to those files. When someone will click that link, it will be asked for a username and password in a popup window that the browser will open. If you don't want to appear that window, you can set your server to redirect the user to a php script, for a certain Status code that is generated when authorization is required, and that PHP script can ask nice for a username and password that can be used then by the script to allow access to that file (but this way might be more complicated without real benefits). Teddy Teddy ----- Original Message ----- From: "Aaron Todd" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 19, 2004 8:30 PM Subject: [PHP] downloading files > I posted a simular question before and never really got an answer. The post > drifted off into some other valuable information, but I still have the same > question. > > I am trying to create a site with file downloads. The files on the server > that are to be downloaded need to be protected somehow. I have already > created a login page for the site so users must log in. The download files > are in a directory protected by htaccess which it is my understanding that > PHP can go underneath htaccess to get access to the files. My problem is > where do I put this directory? I was already told to put it outside the web > root directory, but I really dont know where the best place is. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php