Skip to content
Advertisement

If php session exists, then download file a file from .htaccess locked folder

I have been looking to find a good guide on how to securely download files from a website only if a user session exists.

The files in the download folder should NOT be accessible if a user session doesn’t exist.

Therefore I assume the folder the files are stored in needs to be “locked” by a .htaccess file? Alternatively stored outside the root folder? Which is the best?

If anyone could point me to a good guide/tutorial for this it would be very much appreciated. Thanks

Advertisement

Answer

This is what I ended up doing which worked well. In my scenario I store my files outside of the root folder.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement