I have pdf files in a htaccess-protected directory that I want to show to some users in Yii application.
How is best to solve that? I understand it should be done inside Yii, not w开发者_如何学Cith a separate script as it needs to check if a valid user is logged in.
Access control filters
You would do your appropriate security checking (user is in group, or has permission or whatever) and then you would use readfile
or something similar.
Do you have code already that isn't working? Or did you just need help with what approach to take?
Thanks!
I got some idea from this link:
http://harrybailey.com/2011/07/yii-rewrite-files-or-images-for-download-or-display/
In short: made a new actionfunction into controller and in that function sending headers and readfile.
精彩评论