选择显示字体大小

把文件存进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>企业管理系统</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>

*****************************************************************
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
%>


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons