我是 Laravel 的新手并试图存储私人图像,以便只有经过身份验证的用户才能访问它们.首先,我将图像存储在 Public/UserImages 文件夹中.但在这里,未经身份验证的用户也可以访问所有图片,方法是转到 Inspect Element of chrome 然后更改用户 ID.请帮帮我...
I am new to Laravel and trying to store private images so that only authenticated users can access them. Firstly I stored images in Public/UserImages folder. But here all the pictures are accessible to unauthenticated users as well by going to Inspect Element of chrome and then changing the user IDs. Kindly help out me...
推荐答案这完全取决于您.它需要在 public 目录之外 - 我个人会选择 resources/uploads 或 storage/uploads,或者将它们存储起来 -服务器完全使用云文件系统支持.
It's really up to you. It'll need to be outside the public directory - I'd personally pick resources/uploads or storage/uploads, or store them off-server entirely using the cloud filesystem support.
无论您选择什么,您都需要一个路径来获取文件,并在首先检查用户是否具有访问权限后将其传递给用户.
Whatever you pick, you'll need a route that fetches the file and passes it along to the user after first checking that they have access.
更多推荐
如何处理laravel 5中的私人图像?
发布评论