Sql Server 2012 store pdf(Sql Server 2012 存储pdf)
问题描述
如何在数据库中存储 PDF 文件以及如何使用 asp.net 显示预览.PDF文件由控件上传,然后我需要显示预览,然后我存储到数据库中.
How to store PDFs file in database and how to show preview using the asp.net. the PDFs file is uploaded by control and then i need to show preview afterward i store into the database.
<input type="file" />
推荐答案
通常,您可以选择以下技术之一:
Generally, you can choose one of the following techniques:
- 将文件上传到服务器的特定文件夹中,并仅将文件的
URL存储在数据库中.之后,使用URL显示或下载文件 - 在
BLOB(BinaryLargeOBject) 字段中上传文件并存储在数据库中
- Upload the file in specific folder in your server and store in your database only the
URLto the file. Latter, use theURLfor showing or downloading the file - Upload the file and store in the database in
BLOB(BinaryLargeOBject) field
每一个都有优点和缺点,这取决于你的情况,你可以决定使用哪种技术.
Each of these, has advantages and disadvantages and it is up to your situation and you to decided which technique for use.
幸运的是,当我们使用 SQL Server 存储文件时,我们还有一个选项可以带来更好的性能 - 文件流存储.
Fortunately, when we are using SQL Server for storing files we have one more option which can lead to better performance - Filestream Storage.
建议在以下情况下使用这种类型的存储:
This type of storage is recommended in the following situations:
- 存储的对象平均大于 1 MB.
- 快速读取访问很重要.
- 您正在开发使用中间层的应用程序应用逻辑
因为很少有 PDF 文件小于 1 MB,我相信您应该使用这种技术,但是:
Since, rarely PDF files are smaller then 1 MB, I believe you should use this technique but:
对于较小的对象,在数据库中存储 varbinary(max) BLOB通常提供更好的流媒体性能.
For smaller objects, storing varbinary(max) BLOBs in the database often provides better streaming performance.
您可以查看以下本 教程以激活存储.
You can check the following this tutorial in order to activate the storage.
这篇关于Sql Server 2012 存储pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Sql Server 2012 存储pdf
基础教程推荐
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
