用户图片 - 数据库与文件系统存储 [英] User images - database vs. filesystem storage

查看:273
本文介绍了用户图片 - 数据库与文件系统存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个上传功能在.NET中的用户配置文件presentation图像。我在两个不同的做这件事的方式之间进行选择,并且想问的建议和意见,以利弊。

I’m writing an upload function in .NET for presentation images on user profiles. I’m choosing between two different ways of doing it, and would like to ask on advice and opinions as to the pros and cons.

  1. 直接存储图像文件系统上

  1. Store the images directly on the file system

存储图像数据库

到目前为止,我已经大多亲的第一个选项 - 在用户名后命名的图像,每个用户只能有一个presentation图像。然后,我在指定的路径进行检查,如果用户有一个形象,如果不是显示默认的无图像 - 图像。

So far I’ve been mostly pro the first option – naming the images after the usernames, as each user can only have one presentation image. Then I do a check in the designated path if the user has an image, if not display a default "no image"-image.

另一件我喜欢的是,它可以节省空间,在DB - 数据库将没有额外的二进制负载pretty的重

Another thing I like about this is that it saves space in the DB – the DB will be pretty heavy without the extra binary load.

我敢肯定有,我还没有想过其他方面,所以我想听听你对此事的看法。如果任何人的有一个根本不同的解决问题的办法,请分享的!

I’m sure there are other aspects that I’ve not thought about, so I’d like to hear your opinions on this. If anyone’s got a radically different solution to the problem, please share that as well!

推荐答案

你的问题之前已经回答了计算器:

Your question has been answered before on StackOverflow:

<一个href="http://stackoverflow.com/questions/561447/store-pictures-as-files-or-in-the-database-for-a-web-app">Store图片为文件或数据库的Web应用程序

包括其他许多重复的问题!

Including many other duplicate questions!

这篇关于用户图片 - 数据库与文件系统存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆