lucius Posted October 22, 2009 Share Posted October 22, 2009 I want to secure a folder, but allow index.php in another director to access these files to output to the visitor. How do I go about this? Quote Link to comment https://forums.phpfreaks.com/topic/178648-securing-a-folder-while-allowing-specified-access/ Share on other sites More sharing options...
cags Posted October 22, 2009 Share Posted October 22, 2009 An .htaccess file with the following should work. Deny From All Allow From 127.0.0.1 Quote Link to comment https://forums.phpfreaks.com/topic/178648-securing-a-folder-while-allowing-specified-access/#findComment-942311 Share on other sites More sharing options...
Mchl Posted October 22, 2009 Share Posted October 22, 2009 Or just move this folder out of web rot directory. Quote Link to comment https://forums.phpfreaks.com/topic/178648-securing-a-folder-while-allowing-specified-access/#findComment-942312 Share on other sites More sharing options...
lucius Posted October 22, 2009 Author Share Posted October 22, 2009 Or just move this folder out of web rot directory. I moved the files. Can I allow them to be downloaded? Quote Link to comment https://forums.phpfreaks.com/topic/178648-securing-a-folder-while-allowing-specified-access/#findComment-942382 Share on other sites More sharing options...
PFMaBiSmAd Posted October 22, 2009 Share Posted October 22, 2009 Can I allow them to be downloaded? Yes, if you use a php script as the file name in the download link on a page. The php script will output the correct headers followed by the contents of the correct file. What exactly are you trying to accomplish? You did not initially mention needing to download the files. Quote Link to comment https://forums.phpfreaks.com/topic/178648-securing-a-folder-while-allowing-specified-access/#findComment-942476 Share on other sites More sharing options...
lucius Posted October 23, 2009 Author Share Posted October 23, 2009 Can I allow them to be downloaded? Yes, if you use a php script as the file name in the download link on a page. The php script will output the correct headers followed by the contents of the correct file. What exactly are you trying to accomplish? You did not initially mention needing to download the files. Sorry, here's a better explanation: Two things need to be able to happen, first off I need to output the files into index.php and also be able to be downloaded. These are primarily video files that will be either streamed or downloaded. What type of PHP script do I use? Quote Link to comment https://forums.phpfreaks.com/topic/178648-securing-a-folder-while-allowing-specified-access/#findComment-942899 Share on other sites More sharing options...
lucius Posted November 3, 2009 Author Share Posted November 3, 2009 I simply need to know how to call a file from a folder outside of my public_html. Quote Link to comment https://forums.phpfreaks.com/topic/178648-securing-a-folder-while-allowing-specified-access/#findComment-950349 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.