Prevent Direct File Access

Hello,

I’m new at Yii framework, and this forum has been a great help.

But now i’m lost :)

I have a members area in the site and I want to give access to some files for the members only. For example I added 1 file for the user: joe. When joe make the login he can see that file and can download the file. The problem is that i want to prevent direct access to that file, i.e, only joe can access to this site. It’s possible to make this with yii :)

Thanks

Luís

You can create non-accessible from web folder and place all your private files there.

Then you can provide download link via controller that requires authorization.

Maybe you will also find this function helpful: http://www.yiiframework.com/doc/api/1.1/CHttpRequest#sendFile-detail