将pdf文件保存在数据库中 [英] Save pdf file in database

查看:837
本文介绍了将pdf文件保存在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用文件上传控制的情况下直接将pdf文件插入数据库.
pdf文件已保存在C:drive中!
请给我帮助!!

How can be insert pdf file in database directly without use file upload control .
pdf file already save in C:drive !
Please Give mi help !!

推荐答案

取决于C:驱动器的位置.

如果它在您的服务器上,则很容易:只需将文件作为字节流读取(使用File.ReadAllBytes),然后使用参数化查询将其写入数据库.

如果它在客户端上,则不能-您必须先使用上载控件将其传输到服务器.
Depends on where the C: drive is.

If it is on your Server, then it is easy: just read the file as a stream of bytes (use File.ReadAllBytes) and write it to the database using a parametrised query.

If it is on the client, then you can''t - you have to use an upload control to transfer it to the server first.


这篇关于将pdf文件保存在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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