S
S
Space2018-02-24 12:35:16
PHP
Space, 2018-02-24 12:35:16

How to prevent access to photos from other users?

How to prevent access to photos from other users? Now all photos of all users are in a public folder. I need each authorized user to have access only to their own photos, and not authorized to have access at all.
You can move it to a folder where there is no direct access or block access with some key, but how? I know that Facebook is implemented in such a way that a token is supplied at the end and if it is not there, then you will not get access to the photo:
fb.com/foto.png?token=lalalalallalalalalal I
use laravel 5.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Entelis, 2018-02-24
@DmitriyEntelis

two options:
1. assign files long, hard-to-choose paths/names.
plus: it works very fast, there is no additional load on the server
minus: the picture has a public url that can be compromised
2. we put the files in a folder inaccessible from the outside, access to them goes through a script that checks the user's authorization
pluses and minuses, respectively, vice versa.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question