存储图像,pdf和声音文件 [英] Storing images,pdf and sound files

查看:63
本文介绍了存储图像,pdf和声音文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai Frieds,
我想在应用程序中存储图像文件,pdf和声音文件.存储此类文件的最佳方法是什么.sqlserver 2005是否可以? ,将来有什么问题吗?

谢谢adv

Hai Frieds,
I wanna store image files , pdf and sound files in my application.What is the best method of storing these type of files.Is it possible with sql server 2005 ?, how ? ,any problem in future ?

Thanks adv

推荐答案

尝试
http://www.shabdar.org/sql-server/105-store-save-images-in-sql-server.html [使用Microsoft .NET从SQL Server存储和检索图像 [ ^ ]
http://www.redmondpie.com/inserting -in-and-retrieving-image-from-sql-server-database-using-c/ [
Try
http://www.shabdar.org/sql-server/105-store-save-images-in-sql-server.html[^]
Storing and Retrieving Images from SQL Server using Microsoft .NET[^]
http://www.redmondpie.com/inserting-in-and-retrieving-image-from-sql-server-database-using-c/[^]


实际上有两个选择用于存储文件.在您做出选择之前,值得考虑这些方法背后的原因是什么.第一种选择是将文件保留在文件系统中,仅将位置存储在数据库中(还包括原始文件名之类的信息).
  • 如果您有可能要转移到其他数据库,那么与从数据库中重新创建文件并以新的数据库格式重新上传文件相比,这是一个更简单的选择.
  • 存储文件为您提供了检索文件的更多选择,而无需编写自己的自定义提取例程.
  • 如果您使用的是SQL Server 20005的快速版,则大小上限为2GB.
  • 取决于要执行的操作,例如仅在网页上具有指向该文件的链接,这可能需要您提取文件并将它们写入需要清除的临时位置.如果仅将文件存储在磁盘上,则不必担心,链接将更快地生成.
There are, effectively, two options for storing your files. It''s worth considering what the reasoning behind these methods are before you make your choice. The first option is to keep your files in the file system, and just store the location in the database (also including information such as the original filename).
  • If there''s a potential that you are going to move to a different database, then this is a simpler option than recreating the files from the database, and reuploading them in the new database format.
  • Storing the files gives you more choices for retrieving the files, without having to write your own custom extraction routines.
  • If you''re using the express edition of SQL Server 20005, there''s a 2GB limit to it''s size. This would soon fill up if you were using files.
  • Depending on what you want to do, e.g. just have a link to the file on a web page, this could require you to have to extract the files and write them to a temporary location which would need clearing up. If you just store the file on the disk, you don''t have to worry about this, and the link will be quicker to generate.
  • 如果您有存档策略,例如删除旧文件,则需要维护两个彼此独立的更改点,这需要做更多的工作.换句话说,如果将文件存储在磁盘上并移动它,则还必须更新数据库-但是如果数据库更新失败会怎样?您已断开文件和指向该文件的数据行之间的连接.
  • 如果将文件上传到存储,则必须确保文件名是唯一的.这将意味着使用随机分配的名称(可能是GUID)保存文件,并将两者之间的映射存储在数据库中.如果文件在数据库中,则无需更改文件名.
  • 在文件系统上存储文件需要对文件存储位置具有写权限.不一定总是可以授予此访问权限.


是的,它可以作为字节数组存储在DB中.但是我建议存储图像,文件和pdf而不是DB.
如果存储在数据库中,它将使您的数据库更笨重.将文件路径存储在数据库中.诸如此类的问题会使您的数据库更庞大,维护成本也会更多,速度会受到阻碍.
yah its possible to store in DB as byte array.but i would suggest to store the images, files & pdf in the folder instead of DB.
if you store in the DB, it will make your DB more bulky. store the file path in the database. problems like it will make your database more bulky, maintenance cost will be more, speed will hamper.


这篇关于存储图像,pdf和声音文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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