如何处理laravel 5中的私人图像?

编程入门 行业动态 更新时间:2024-10-23 22:24:05
本文介绍了如何处理laravel 5中的私人图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是 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中的私人图像?

本文发布于:2023-11-02 08:23:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551882.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何处理   图像   私人   laravel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!