首页/技术开发/内容

把文件存进access数据库然后取出来供人下载的代码

技术开发2024-02-19 阅读()
",-1,1)
for each sendtoinf in mysendto
userdeptpoint=InStr(sendtoinf,":")
if userdeptpoint>0 then
sendtoinflen=len(sendtoinf)
recipientusername=right(sendtoinf,sendtoinflen-userdeptpoint)
if recipientusername="所有人" then
recipientusername="所有人"
else
usernamepoint=Instr(recipientusername,"(")
usernamelen=len(recipientusername)
recipientusername=left(recipientusername,usernamelen-1)
recipientusername=right(recipientusername,usernamelen-1-usernamepoint)
end if
recipientuserdept=left(sendtoinf,userdeptpoint-1)
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("ADODB.recordset")
sql = "select * from senddate"
rs.Open sql,conn,1,3
rs.addnew
rs("title")=title
rs("content")=content
rs("sender")=oabusyusername
rs("recipientusername")=recipientusername
rs("recipientuserdept")=recipientuserdept
if filename<>"" then
rs("filename")=filename
rs("fileContentType")=fileContentType
rs("filevalue").appendchunk filevalue
end if
rs.update
rs.close
set rs=nothing
set conn=nothing

end if

next

%>
<br><br>
<center>发送完成</center>
<%
end if
%>
<%
call bgback()
%>
</body>
</html>

*****************************************************************
listsendfile.asp (把数据库里面的文件取出来并下载,如果是文本或图像会直接打开)
<!--#include file="asp/opendb.asp"-->
<%
set conn=opendb("oabusy","conn","accessdsn")
Set rs=Server.CreateObject("ADODB.recordset")
'request("id")是从上一个文件传过来的值,表示这个文件在数据库里的位置
sql="select filevalue,fileContentType from senddate where id=" & trim(request("id"))
rs.open sql,conn,1,1
Response.ContentType = rs("fileContentType")
Response.BinaryWrite rs("filevalue").getChunk(7500000)
rs.close
set rs=nothing
set conn=nothing
%>




第1页  第2页 

……

相关阅读