User Folder/area - need some guidance plz

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikeman
Forum Newbie
Posts: 18
Joined: Wed Apr 07, 2010 7:18 am

User Folder/area - need some guidance plz

Post by mikeman »

I would like some advice/methods you would use for a site where once a user has registered, a folder is created on the server where they can upload and store their documents and pictures securely - ie no one else can access them.

I tried making a folder with php and getting php to generate a htaccess and htpasswd file - but I couldn't seem to get this to work very well.

Unfortunately this particular site is on a shared host so I cannot put the files in a folder outside of the public folder which is a method I had read about.

Any guidance would be appreciated.
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: User Folder/area - need some guidance plz

Post by greyhoundcode »

How about using .htaccess to stop all public access to a specified folder (forget about .htpasswd). The folder, let's call it protected/, would however still be accessible to your own scripts. So you could then have a gateway script accessfile.php that allows logged in users to get to those protected files.

Alternatively, how about storing the files in a database? (Though there could be some performance issues there)
Post Reply