首页 ┆ 网站地图 ┆ 在线留言 ┆ 游戏资讯 ┆ 资源下载 ┆ 端午节祝福 ┆ 迅雷在线影视 ┆淘宝手机在线充值 ┆淘宝游戏点卡充值 
设为首页
加入收藏
联系我们
高级搜索
您当前的位置: 主页>ASP专区>ASP教学>asp实现把文件存进access数据库并提供下载的代码
asp实现把文件存进access数据库并提供下载的代码
来源: 发布时间:2008-10-21 发布人: 浏览: 人次   字体: [ ]  

  本文的代码是指把文件存进access数据库然后取出来供人下载,希望对大家有用!
senddate.asp(发送界面)

<form method="post" ENCTYPE="multipart/form-data" name="form3" action="senddateindb.asp">
<input type="hidden" name="userdept" value="<%=firstdept%>">
<input type="hidden" name="username" value="所有人">
<td align="center"><b>发给:</b></td><td><input type="text" name="sendto" size=60 value="<%=sendto%>" onfocus="document.form3.title.focus();"><font color=red>*</font></td>
</tr>
<tr>
<td align="center"><b>标题:</b></td>
<td><input type=text name="title" size=60><font color=red>*</font></td>
</tr>
<tr>
<td align="center"><b>内容:</b></td>
<td><textarea name="content" rows="9" cols="60"></textarea></td>
</tr>
<tr>
<td align="center"><b>附件:</b></td>
<td><input type="file" name="file1" size=35>(不能超过100K)</td>
</tr>
<tr>
<td align=center colspan=2>
<input type="submit" name="submit" value="发送">
</td>
</form>

*************************************************************************
senddateindb.asp(把要发送的文件保存到数据库)

<!--#INCLUDE FILE="asp/fupload.inc"-->
<!--#include file="asp/opendb.asp"-->
<!--#include file="asp/sqlstr.asp"-->
<!--#include file="asp/checked.asp"-->
<!--#include file="asp/bgsub.asp"-->
<%
'On Error Resume Next
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if oabusyusername="" then response.redirect "default.asp"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" href="css/css.css">
<title>企业管理系统_IT知道网itwis.com</title>
</head>
<body bgcolor="#eeeeee" topmargin="5" leftmargin="5">
<%
call bghead()
%>
<center>
<table>
<tr>
<td>
<b>公文发送</b>
</td>
<form action="senddate.asp" method="post" name="form1">
<td>
<input type="submit" value="返回">
</td>
</form>
</tr>
</table>
</center>
<%
call bgmid()
%>

<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" Then
'---------------------------
'response.write "开始发送<br>"
'---------------------------
Dim Fields
UploadSizeLimit=100000
Set Fields = GetUpload()
dim Field
For Each Field In Fields.Items
if Field.name="title" then title=BinaryToString(Field.value)
if Field.name="content" then content=BinaryToString(Field.value)
if Field.name="sendto" then sendto=BinaryToString(Field.value)
if Field.name="file1" then
filename=field.FileName
fileContentType=field.ContentType
filevalue=field.value
end if
next
'--------------------------------------
'response.write "title=" & title & "<br>"
'response.write "content=" & content & "<br>"
'response.write "sendto=" & sendto & "<br>"
'response.write "filedname=" & filename & "<br>"
'response.write "fileContentType=" & fileContentType & "<br>"
'----------------------------------------
dim mysendto
mysendto=split(sendto,"|",-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>


共2页: 上一页 1 [2] 下一页
相 关 文 章   发布商链接
·vbscript保留日期格式中的月份和日期...
·asp遍历某路径下文件夹并实现MP3数据...
·asp+javascript实现无刷新显示文章列...
·ASP脚本基础
·Asp实现人民币大小写转换代码
·ASP页面将数据库中检索数据生成到本...
·asp实现文件转移、压缩并直接存进数...
·ASP 实现压缩与解压代码
·ASP上传图片到数据库的代码
·VBS脚本调用系统的关机对话框代码
 §最新评论:(评论内容只代表网友观点,与本站立场无关!)
网名: 验证码:  【所有评论】【↑返回顶部
评 分: 12 345
评论内容:(不能超过500字,请自觉遵守互联网相关政策法规。[按 Ctrl+Enter 可直接提交]
注意:请勿在本站发布政治话题、色情及违反法律的内容。
IT知道网 声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。
推 荐 文 章
·asp遍历某路径下文件夹并实现...
·vbscript保留日期格式中的月...
·如何利用ASP把图片上传到数据
·如何在IIS中执行Python脚本的
·ASP语言采用动网数据库制作显
·Asp开发的可以用来做采集与分
·Asp技术实现数据导入进度状态
·asp防采集常用的六种方法
·asp动态生成RSS完整版代码
·ASP版+Ajax实现验证码通用模...
·asp中文数字验证码实现的代码
·VBS脚本调用系统的关机对话框
·ASP上传图片到数据库的代码
·ASP 实现压缩与解压代码
·asp实现文件转移、压缩并直接
热 门 文 章
·如何利用ASP把图片上传到数据...
·VBS脚本调用系统的关机对话框...
·ASP版+Ajax实现验证码通用模...
·asp中文数字验证码实现的代码
·asp动态生成RSS完整版代码
·Asp开发的可以用来做采集与分...
·ASP上传图片到数据库的代码
·ASP页面将数据库中检索数据生...
·Asp实现人民币大小写转换代码
·ASP语言采用动网数据库制作显...
·asp实现文件转移、压缩并直接...
·ASP脚本基础
·ASP 实现压缩与解压代码
·asp防采集常用的六种方法
·如何在IIS中执行Python脚本的...
网站首页 - 关于本站 - 加入收藏 - 网站地图 - 友情连接 - 在线留言 - 联系我们 - 返回顶部
Copyright © 2007 IT知道网.[冀ICP备07026896号]. All Rights Reserved .