Office中国论坛/Access中国论坛

标题: 把文件存进access数据库然后取出来供人下载的代码(取自e-office部分模块) [打印本页]

作者: WTM1    时间: 2002-9-21 01:25
标题: 把文件存进access数据库然后取出来供人下载的代码(取自e-office部分模块)
senddate.asp(发送界面)<form&nbsp;method="post"&nbsp;ENCTYPE="multipart/form-data"&nbsp;name="form3"&nbsp;action="senddateindb.asp">
<input&nbsp;type="hidden"&nbsp;name="userdept"&nbsp;value="<%=firstdept%>">
<input&nbsp;type="hidden"&nbsp;name="username"&nbsp;value="所有人">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td&nbsp;align="center"><b>发给:</b></td><td><input&nbsp;type="text"&nbsp;name="sendto"&nbsp;size=60&nbsp;value="<%=sendto%>"&nbsp;onfocus="document.form3.title.focus();"><font&nbsp;color=red>*</font></td>
&nbsp;&nbsp;&nbsp;&nbsp;</tr>
&nbsp;&nbsp;&nbsp;&nbsp;<tr>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td&nbsp;align="center"><b>标题:</b></td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td><input&nbsp;type=text&nbsp;name="title"&nbsp;size=60><font&nbsp;color=red>*</font></td>
&nbsp;&nbsp;&nbsp;&nbsp;</tr>
&nbsp;&nbsp;&nbsp;&nbsp;<tr>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td&nbsp;align="center"><b>内容:</b></td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td><textarea&nbsp;name="content"&nbsp;rows="9"&nbsp;cols="60"></textarea></td>
&nbsp;&nbsp;&nbsp;&nbsp;</tr>
&nbsp;&nbsp;&nbsp;&nbsp;<tr>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td&nbsp;align="center"><b>附件:</b></td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td><input&nbsp;type="file"&nbsp;name="file1"&nbsp;size=35>(不能超过100K)</td>
&nbsp;&nbsp;&nbsp;&nbsp;</tr>
&nbsp;&nbsp;&nbsp;&nbsp;<tr>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td&nbsp;align=center&nbsp;colspan=2>
<input&nbsp;type="submit"&nbsp;name="submit"&nbsp;value="发送">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
</form>*************************************************************************
senddateindb.asp(把要发送的文件保存到数据库)<!--#INCLUDE&nbsp;FILE="asp/fupload.inc"-->
<!--#include&nbsp;file="asp/opendb.asp"-->
<!--#include&nbsp;file="asp/sqlstr.asp"-->
<!--#include&nbsp;file="asp/checked.asp"-->
<!--#include&nbsp;file="asp/bgsub.asp"-->
<%
'On&nbsp;Error&nbsp;Resume&nbsp;Next
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if&nbsp;oabusyusername=""&nbsp;then&nbsp;response.redirect&nbsp;"default.asp"
%>
<html>
<head>
<meta&nbsp;http-equiv="Content-Type"&nbsp;content="text/html;&nbsp;charset=gb2312">
<meta&nbsp;name="GENERATOR"&nbsp;content="Microsoft&nbsp;FrontPage&nbsp;4.0">
<meta&nbsp;name="rogId"&nbsp;content="FrontPage.Editor.Document">
<link&nbsp;rel="stylesheet"&nbsp;href="css/css.css">
<title>企业管理系统</title>
</head>
<body&nbsp;bgcolor="#eeeeee"&nbsp;topmargin="5"&nbsp;leftmargin="5">
<%
call&nbsp;bghead()
%>
<center>
<table>
<tr>
<td>
<b>公文发送</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<form&nbsp;action="senddate.asp"&nbsp;method="post"&nbsp;name="form1">
<td>
<input&nbsp;type="submit"&nbsp;value="返回">
</td>
</form>
</tr>
</table>
</center>
<%
call&nbsp;bgmid()
%><%
if&nbsp;Request.ServerVariables("REQUEST_METHOD")&nbsp;=&nbsp;"OST"&nbsp;Then
'---------------------------
'response.write&nbsp;"开始发送<br>"
'---------------------------
Dim&nbsp;Fields
UploadSizeLimit=100000
Set&nbsp;Fields&nbsp;=&nbsp;GetUpload()
dim&nbsp;Field
For&nbsp;Each&nbsp;Field&nbsp;In&nbsp;Fields.Items
if&nbsp;Field.name="title"&nbsp;then&nbsp;title=BinaryToString(Field.value)
if&nbsp;Field.name="content"&nbsp;then&nbsp;content=BinaryToString(Field.value)
if&nbsp;Field.name="sendto"&nbsp;then&nbsp;sendto=BinaryToString(Field.value)
if&nbsp;Field.name="file1"&nbsp;then
filename=field.FileName
fileContentType=field.ContentType
filevalue=field.value
end&nbsp;if
next
'--------------------------------------
'response.write&nbsp;"title="&nbsp;&&nbsp;title&nbsp;&&nbsp;"<br>"
'response.write&nbsp;"content="&nbsp;&&nbsp;content&nbsp;&&nbsp;"<br>"
'response.write&nbsp;"sendto="&nbsp;&&nbsp;sendto&nbsp;&&nbsp;"<br>"
'response.write&nbsp;"filedname="&nbsp;&&nbsp;filename&nbsp;&&nbsp;"<br>"
'response.write&nbsp;"fileContentType="&nbsp;&&nbsp;fileContentType&nbsp;&&nbsp;"<br>"
'------------------
作者: airlulu    时间: 2002-9-22 07:06
严重支持!
作者: lgxysl    时间: 2002-9-23 02:32
不知这样做有什么好处?
作者: WTM1    时间: 2002-9-23 17:24
如果是网中!大家可以用access进行数据交换!
多想!想!!




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3