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

📄 uploadpost.asp

📁 网络教学平台由教师教学系统、学生学习系统和教学管理系统三大模块组成
💻 ASP
字号:
<!--#include file="Inc/Const.asp" -->
<!--#include file="Inc/iXs_clsUp.asp" -->
<!-- #include file="../inc/conn.asp" -->
<!--#include file = "../CheckLogin.asp" -->

<%
	Dim strSujectID ,strTeacherID ,strTeachingSujectID ,RS
	strSujectID = Session("SujectID")
	strTeacherID = Session("TeacherID")
	strTeachingSujectID = Session("TeachingSujectID")
	If strSujectID <> "" Then
		Session("SujectID") = strSujectID
	Else
		Response.Write("参数错误!")
		Response.End
	End If
	
	If strTeacherID <> "" Then
		Session("TeacherID") = strTeacherID
	End If
	
		
	If strTeachingSujectID <> "" Then
		Session("TeachingSujectID") = strTeachingSujectID
	End If
	
	strUserName = Session("UserName")
	strUserType = Session("UserType")
	Session("UserName") = strUserName
	Session("UserType") = strUserType


%>
<%
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Server.ScriptTimeout = 9999

If iXs.IsSelfRefer = False Then	Call iXs.Alert("对不起,不允许外部调用!!", iXs.Sys_Info(5), 0)

Dim M0, M1, M2, M3, M4, M5, M6, M7, M8, M9
Dim ObjUpType, bgColor, Wid
Dim Action
Dim n, Self_Referer
Dim iXs_UF, StrFile, UpLoaddingDate

' 上传接口背景颜色
bgColor = iXs.ReqStr("bgColor")
If bgColor = "" Then bgColor = "buttonface"
' 文件类型
ObjUpType = iXs.ReqNum("ObjUpType")
If ObjUpType = "" Then ObjUpType = 0
Action = iXs.ReqNum("Action")
If Action = "" Then Action = 0
' 目标位置
Wid = iXs.ReqNum("Wid")
If Wid = "" Then Wid = 0
' 上传进度数据文件名 为了适应多用户 多进程相互独立显示而增加
iXs.ReqNumLen = 18
UpLoaddingDate = iXs.ReqNum("UpLoaddingDate")
If UpLoaddingDate = "" Then UpLoaddingDate = 0

'M0 ' 文件名称
'M1 ' 扩展名称
'M2 ' 保存路径
'M3 ' MIME类型
'M4 ' 文件大小
'M5 ' 图片宽度
'M6 ' 图片高度
'M7 ' 本地路径
'M8 ' 上传方法
'M9 ' 原文件名

n = 0
Self_Referer = Request.ServerVariables("HTTP_REFERER")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style type="text/css">
	@charset "gb2312";
	body,td,th {color: #000000;font: 12px Verdana, Arial, Helvetica, sans-serif, "宋体"}
	body{margin:0px; background-color:<% = bgColor %>;}
	a:link {text-decoration: none; color: #0000FF;}
	a:visited {text-decoration: none; color: #0000FF;}
	a:hover {text-decoration: underline; color: #FF0000;}
	a:active {text-decoration: none; color: #880000;}
</style>
<script id="downLoadControl" language="JavaScript" type="text/javascript"></script>
<script language="javascript1.2">
<!--
	// 删除进度数据文件
	function downLoadData(url){
		try{downLoadControl.src = url;}
		catch(e){}
	}
//-->
</script>
<SCRIPT FOR="window" EVENT="onunload">
<!--
	// 当窗口强制卸载的时候删除进度数据文件
	downLoadData("iXs_StartUpLoad.asp?UpLoaddingDate=<% = UpLoaddingDate %>");
//-->
</SCRIPT>
</head>
<body>
<%
If Action = 1 Then
	Set iXs_UF = New iXs_ClsUp
	
	iXs_UF.TotalSize 	= iXs.Sys_Info(33)	' 上传总大小
	iXs_UF.MaxSize 		= iXs.Sys_Info(34)	' 单文件大小
	iXs_UF.FileType  	= iXs.Sys_Info(35)	' 文件类型
	iXs_UF.SavePath 	= iXs.Sys_Info(36)	' 保存路径
	' 指定时区为服务器系统时区
	' 防止客户端变换时区造成附件命名可能出现的重复和混乱情况的发生
	iXs.TimeZone = iXs.Sys_Info(31)
	' 以服务器系统时区获取时间字符串
	iXs_UF.StrDate = iXs.FormatTime(Now(), 5)
	' 上传进度数据文件名
	iXs_UF.UpLoaddingDate = UpLoaddingDate
	' 打开上传对象
	iXs_UF.Open()
	
	If iXs_UF.Error = 1 then
		Response.Write("<br>数据大小超过限制,上传失败!")
	ElseIf iXs_UF.Error = 2 then
		Response.Write("<br>包含非法文件类型,上传失败!")
	ElseIf iXs_UF.Error = 3 then
		Response.Write("<br>数据大小超过限制,并包含非法文件类型,上传失败!")
	ElseIf iXs_UF.Error = 4 then
		Response.Write("<br>数据总数量超过限制,上传失败!")
	Else
		StrFile = iXs_UF.FileItem
		Call FileSave(StrFile)
		Response.Write("成功添加了 <font color=""#FF0000""><strong>" & n & "</strong></font> 个文件!")
	End If
	Response.Write("<SCRIPT language=""javascript1.2"">downLoadData(""iXs_StartUpLoad.asp?UpLoaddingDate=" & UpLoaddingDate & """);</SCRIPT>")
	Response.Write("<SCRIPT language=""javascript1.2"">window.setTimeout(""location.href='" & Self_Referer & "';"", 2500);</SCRIPT>")
	Set Acc = Nothing
End If

Sub FileSave(StrFile)
	Dim i, FormName, IsRemote, Str
	Dim ID
	For i = 1 To UBound(StrFile)
		FormName = iXs_UF.FileItem(i)
		IsRemote = 0
		If iXs_UF.Form(FormName) <> "" Then
			n = n + 1
			M0 = iXs_UF.Form(FormName) ' 文件名称
			M1 = LCase(iXs_UF.Form(FormName & "_Ext")) ' 扩展名称
			M2 = Replace(iXs_UF.SavePath & iXs_UF.Form(FormName),"\","/") ' 保存路径
			M3 = iXs_UF.Form(FormName & "_Type") ' MIME类型
			M4 = iXs_UF.Form(FormName & "_Size") ' 文件大小
			M5 = iXs_UF.Form(FormName & "_Width") ' 图片宽度
			M6 = iXs_UF.Form(FormName & "_Height") ' 图片高度
			M7 = Replace(iXs_UF.Form(FormName & "_Path"), "\", "\\") ' 本地路径
			M8 = IsRemote ' 上传方法
			M9 = iXs_UF.Form(FormName & "_Name") ' 原文件名
			
			
			Set RS = Server.CreateObject("ADODB.Recordset")			
			RS.Open "StudyMaterial", conn, 1, 2
			RS.AddNew
			RS("Name") = M0
			RS("AddTime") = now()
			RS("AddMan") = Session("UserName")
			RS("Path") = M2
			RS("TeachingSujectID") = strTeachingSujectID
			RS.Update
			RS.Close
		
			'Response.Redirect("../Content.asp")
			Conn.Close
			
			' 这里可以执行一些入库操作
			Response.Write("<script language=""javascript1.2"">try{parent.DoInsert('" & M0 & "', '" & M1 & "', '" & M2 & "', '" & M3 & "', '" & M4 & "', '" & M5 & "', '" & M6 & "', '" & M7 & "', '" & M8 & "', '" & M9 & "');}catch(e){};</script>")
		End If
	Next
End Sub
%>
</BODY>
</HTML>

⌨️ 快捷键说明

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