⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upfile.asp

📁 学校智能办公系统 1、系统包含成绩学籍管理、公文管理、电子备课、教职工管理、照片管理、课件管理等学校办公的多个方面。 2、实行集中管理
💻 ASP
字号:
<%OPTION EXPLICIT
dim conn,dbpath,rs%>
<!--#include FILE="upclass.asp"-->
<!--#include file="opendb.asp"-->
<!--#include file="asp/bgsub.asp"-->
<!--#include file="asp/funct.asp"-->
<!--#include file="asp/sqlstr.asp"-->
<%
dim upfile,formPath,ServerPath,FSPath,formName,FileName,oFile,upfilecount,iCount
upfilecount=0
set upfile=new upfile_class ''建立上传对象
upfile.NoAllowExt="asp;exe;htm;html;aspx;cs;vb;js;"	'设置上传类型的黑名单
upfile.GetData (10240000)   '取得上传数据,限制最大上传10M
%>

<html>
<head>
<title></title>
</head>
<body bgcolor="#eeeeee" topmargin="5" leftmargin="5">
<%
call bghead()
%>
<center>
<table>
<tr>
<td>
<b>公文发送</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<form action="senddate.asp" method="post" name="form1">
<td>
<input type="submit" value="返回">
</td>
</form>
</tr>
</table>
</center>
<%
call bgmid()
%>
<%dim title,sendto,i,bs,content,gs,id,x
filename=""
bs=request.querystring("bs")
i=1
session("bs")=bs

title=upfile.form("title")
sendto=upfile.form("sendto")
content=upfile.form("content")
gs=upfile.form("fjs")
session("gs")=gs
if gs>0 then

formpath=GetFilePath(Server.mappath("upfile.asp"),"\")&"fj\"'取得当前文件在服务器路径
iCount=1
for each formName in upfile.file ''列出所有上传了的文件
 set oFile=upfile.file(formname)
 if oFile.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
id=upfile.GetNewFileName()
x=mid(oFile.filename,instr(oFile.filename,"."))
filename=filename&id&x&"|"
session("id"&iCount)=id&x
  upfile.SaveToFile formname,formPath&id&x   ''保存文件
end if
iCount=iCount+1
set oFile=nothing
next
%>
<%end if%>
<%    if upfile.iserr then 
		Response.Write upfile.errmessage
		else
		'Response.Write "上传成功"
dim mysendto,sendtoinf,userdeptpoint,recipientusername,sendtoinflen,usernamelen,usernamepoint,recipientuserdept,sql,oabusyusername
oabusyusername=request.cookies("oabusyusername")
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="所有人"
elseif 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 rs=server.createobject("ADODB.recordset") 
sql = "select * from senddate"
rs.Open sql,conn,1,3
rs.addnew 
rs("title")=sqlstr(title)
rs("content")=sqlstr(content)
rs("sender")=sqlstr(oabusyusername)
rs("recipientusername")=sqlstr(recipientusername)
rs("recipientuserdept")=sqlstr(recipientuserdept)
rs("filename")=sqlstr(filename)
rs.update 
rs.close 
set rs=nothing 
end if
next

%>
<br><br>
<center>发送完成</center>
<%end if
set upfile=nothing  ''删除此对象
call bgback()
%>

</body>
</html>
<%
function GetFilePath(FullPath,str)
  If FullPath <> "" Then
    GetFilePath = left(FullPath,InStrRev(FullPath, str))
    Else
    GetFilePath = ""
  End If
End function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -