将图像存储在网络根目录之上还是之下?
我正在开发一个网络应用程序,用户可以上传与其帐户关联的图像。我正在尝试找出在文件系统中存储这些图像的最佳方法,同时考虑到组织和安全性。我正在使用基于 JavaScript 的文件上传器,它必须将图像保存在 Web 根目录中,但我想知道将图像移动到 Web 根目录上方是否会更好以提高安全性?对此事的任何想法将不胜感激。
I'm working on a web app where users can upload images which are associated with their account. I'm trying to figure out the best way to store these images in the filesystem taking into account organization and security. I'm using a JavaScript-based file uploader which has to save the images within the web root, but I'm wondering if it would be better to move the images above the web root for better security? Any thoughts on the matter would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从安全角度来看,您可能希望选择一个位置,使用户在使用图像浏览器时无法看到您的网站应用程序图像或目录。因此,除了网站根目录之外,使用不同的目录位置是一个好主意。该位置可以是指向文件系统上任何位置的虚拟目录,只要您设置了适当的目录安全性以通过 Web 服务器读取/写入文件即可。
虚拟目录可以指向您想要的任何位置,并且如果您不时备份所有动态用户文件,可能会使您的备份策略更容易支持。
From a security standpoint, you probably want to select a location where users can't see your website application images or directories when they use your image browser. So a different directory location other than your website root is a good idea. The location can be a virtual directory that points to any location on your file system, as long as you have appropriate directory security set up to read / write files through your web server.
Virtual directories can point wherever you'd like them to, and might make your backup strategies a little easier to support, if you back up all dynamic user files from time to time.