如何下载已经存储在数据库中的文件?

stone4774 2004-08-19 08:53:01
我手中有一个小的系统,在这个系统中,象什么DOC,RAR,TXT之类的文件都存储在一个数据表中,现在要为它们提供一个下载,应该怎么写原码?
象这样行吗?
set Rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
set doc=Server.CreateObject("Doc.Download")

strsql = "select a.doc_name,a.doc_content,b.doc_type_Suffix from tb_doc a,tb_doc_type b " & _
"where a.doc_type_code=b.doc_type_code and a.doc_code=" & request("doc_code")
Set rs= conn.Execute(strsql)
If Not rs.EOF Then
strFileName= server.MapPath("./") & "\download\" & rs.Fields("doc_name") & rs.Fields("doc_type_Suffix")
strDown="<a href='download/" & rs.Fields("doc_name") & rs.Fields("doc_type_Suffix") & "'>点击下载</a>"
doc.FileName=strFileName
doc.BlobColumn=rs.Fields("doc_content")
doc.ReadbolbToFile
End If
...全文
99 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
stone4774 2004-08-19
  • 打赏
  • 举报
回复
doc_content字段里面就是文件的内容!!
stone4774 2004-08-19
  • 打赏
  • 举报
回复
存的是文件本身,不是路径和文件名!!
ryuginka 2004-08-19
  • 打赏
  • 举报
回复
存的是路径和文件名吗?不说清楚怎么回答啊

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧