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. 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. Link to comment https://forums.phpfreaks.com/topic/245244-download-file-link/#findComment-1259628 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.