M
M
Mykola2016-08-22 11:12:14
Yii
Mykola, 2016-08-22 11:12:14

Yii2: limit display (return) of files depending on the role of the user?

Actually a subject.
I put the file in the folder web/tickets/{ID}/file.jpg
How can I prevent this file from being viewed (even if the user has a direct link) if the file is not from the user that uploaded it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Ukolov, 2016-08-22
@iSensetivity

Not to prohibit in any way, you need to remove the files from the web server directory (so that there are no direct links to them) and create a special handler that will read the file from the external directory and give its contents to the browser based on user rights.

V
Vit, 2016-08-22
@fornit1917

Never forbid

Not true. There is an effective option - nginx and x-accel-redirect. See here: https://www.opennet.ru/base/net/nginx_x_accel_redi...
This is much more efficient than giving via php.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question