infratl Posted June 23, 2006 Share Posted June 23, 2006 Hi,I'm designing a login system in which users can login and download manuals in PDF format. I created a script called "dealer.php" in the world readable web directory that calls other scripts that are in a directory called "dealers" that has an htaccess file that denies access from all. Therefore, the files in the "dealer" directory are only accessable via a script, which I'm doing through "dealer.php".My problem now is how to make the browser download a file that is in the directory "dealers/products/pdf" since the "dealers" directory is denying access from all and causing all subdirectories to do the same. In other words, how can I make a PHP script that will make the browser download a file that is in a htaccess restricted directory?I've read about using the header "content-type: application/force-download" or something similar, then using fopen with echo or just readfile to output the contents of the file to the browser. I'm not sure this is the best approach though.Any ideas would be greatly appreciated.Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/12759-php-file-download-script/ Share on other sites More sharing options...
dptr1988 Posted June 24, 2006 Share Posted June 24, 2006 using the header "content-type: application/force-download" and then reading the file is probably the the only way to let a PHP script control downloads. Quote Link to comment https://forums.phpfreaks.com/topic/12759-php-file-download-script/#findComment-48973 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.