📄 upload.asp
字号:
<%
OPTION EXPLICIT
Server.ScriptTimeOut=999999
%>
<!-- #include virtual="/inc/conn.asp" -->
<!--#include virtual = "/CheckLogin.asp" -->
<!--#include virtual="/upload/upfile_class.asp"-->
<%
On error Resume Next
dim objUp, Rs, strPath, fso
dim strTitle, strFileName, strTeachingSujectID
Dim strResult
strPath = "/uploadfile/Archive/" & session("Code")
Set fso = server.createobject("Scripting.FileSystemObject")
If Not fso.folderExists(Server.mappath(strPath)) then
fso.createFolder Server.mappath(strPath)
End If
strPath = strPath & "/" & Year(Now()) & Month(Now()) & "/"
If Not fso.folderExists(Server.mappath(strPath)) then
fso.createFolder Server.mappath(strPath)
End If
set objUp = new UpFile_Class
objUp.AllowExt = "jpg;gif;rar;doc;zip;ppt;txt;mp3;xls;rtf;docx;jar"
objUp.GetData(1024*1024*10)
If objUp.isErr<>0 Then Response.flush
Select Case objUp.isErr
Case 0
objUp.AutoSave "strFile",Server.mappath(strPath)& "\"
If objUp.isErr=3 Then
strResult = "不允许上传该类型"
Else
strResult = "上传成功"
strTitle = objUp.Form("strName")
strFileName = objUp.file("strFile").AutoName
strTeachingSujectID = session("TeachingSujectID")
Set Rs = Server.CreateObject("ADODB.Recordset")
RS.Open "StudyMaterial", conn, 2, 3
RS.AddNew
RS("Name") = strTitle
RS("Path") = strPath & objUp.file("strFile").AutoName
RS("AddMan") = Session("UserName")
RS("AddTime") = now()
RS("TeachingSujectID") = strTeachingSujectID
RS.Update
RS.Close
Set Rs = Nothing
End If
case 1
strResult = "没有数据上传"
case 2
strResult = "文件大小超出"
case 2
strResult = "不允许上传该类型"
End select
Set fso = Nothing
set objUp = nothing
Conn.Close
Set Conn = Nothing
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>网络教学平台</title>
<style>
body
{
width:100%;
height: 100%;
font-size: 12px;
background-color: #B1DB99;
}
#Content
{
}
#Content p a
{
color: #006;
text-decoration: none;
}
</style>
</head>
<body>
<div id="Context">
<%
Response.contenttype = "text/html"
Response.charset = "gb2312"
Response.Flush
'显示字符集
Response.Write("<p id=""Title"">" & strResult & "</p>")
Response.Write "<p>[<a href=""/Content.asp"">返回</a>]</p>"
%>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -