📄 upload_files.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="upload_class.asp"-->
<!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 type="text/css">
body{margin:0px;}
body,td{font-size:12px; color:#000000;}
a{color:#0000FF; text-decoration:underline;}
a:hover{ color:#FF0000;}
</style>
<script language="javascript">
function oCopy(obj)
{
obj.select();
js=obj.createTextRange();
js.execCommand('Copy');
}
</script>
</head>
<body>
<%
Dim formID,objID
Dim FilePath,upload,FileExe,FileExeTmp,fso
Const AllowExe = "jpg,gif,bmp,png,zip,rar,doc,xls,txt,swf"
Const AllowSize = 1024
formID = Request.QueryString("formID")
objID = Request.QueryString("objID")
FilePath = ""
If Trim(Request.QueryString("action")) = "save" Then
If Session("Ok3w_Upfiles_UserName")="" Then
Response.Write("你还没有登陆或是登陆已经超时。")
Response.End()
End If
Set upload = New upload_5xsoft
Set file=upload.file("file")
If file.FileSize>0 then
FileExeTmp = Split(file.FileName,".")
FileExe = Lcase(FileExeTmp(Ubound(FileExeTmp)))
If file.FileSize>AllowSize*1024 Then
Response.Write("文件大小不能超过" & AllowSize & "KB,请<a href=""upload_files.asp"">返回</a>。")
Response.End()
End If
If InStr("," & AllowExe & ",","," & FileExe & ",") <=0 Then
Response.Write("不允许上传该类型文件,请<a href=""upload_files.asp"">返回</a>。")
Response.End()
End If
FilePath = "upfiles/edit/" & Year(Date()) & Right("0"&Month(Date()),2) & "/"
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(Server.MapPath("../" & FilePath)) Then
fso.CreateFolder(Server.MapPath("../" & FilePath))
End If
Set fso = Nothing
FilePath = FilePath & Year(Date()) & Right("0" & Month(Date()),2) & Right("0" & Day(Date()),2) & Right("0" & Hour(Time()),2) & Right("0" & Minute(Time()),2) & Right("0" & Second(Time()),2) & "." & FileExe
file.SaveAs Server.mappath("../" & FilePath)
End If
Set file = Nothing
Set upload = Nothing
End If
%>
<form id="form1" name="form1" enctype="multipart/form-data" method="post" action="?action=save&formID=<%=formID%>&objID=<%=objID%>&rnd=<%=Now()%>">
<%If FilePath="" Then%>
<input type="file" name="file" style="width:200px; border:1px solid #666666;" onKeyPress="return false;" />
<input type="button" name="Submit" value="上传" style="border:1px solid #666666;" onClick="this.disabled=true;this.value='稍候';this.form.submit();" />
<%Else%>
<input name="FilePath" type="text" value="<%=FilePath%>" onClick="oCopy(this);" readonly="readonly" style="width:200px; border:1px solid #666666;" />
<a href="upload_files.asp?formID=<%=formID%>&objID=<%=objID%>">新上传</a>
<script language="javascript">
<%If formID<>"" And objID<>"" Then%>
parent.<%=formID%>.<%=objID%>.value = document.form1.FilePath.value;
<%Else%>
oCopy(document.form1.FilePath);
<%End If%>
</script>
<%End If%>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -