dudejma Posted August 19, 2011 Share Posted August 19, 2011 I'm wanting to have users able to download a file, but I'm wanting it to be a file that only users who are logged in can download. Basically, I don't want a user to be able to enter the URL and download it while not being logged in. Does anyone know what I would use to do this? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/245244-download-file-link/ Share on other sites More sharing options...
Alex Posted August 20, 2011 Share Posted August 20, 2011 One way to accomplish this is to store the files in question outside of your document root so that they are not directly accessible. Then create a PHP file to serve the files. Once you have that all you need to check if the user is logged in before you serve the file. You can look into readfile. Quote Link to comment https://forums.phpfreaks.com/topic/245244-download-file-link/#findComment-1259628 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.