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

📄 upfile.asp

📁 本系统是一套开源WEB的网站管理系统
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%server.ScriptTimeout=1000%>
<!--#include file="../include/config.asp"-->
<!--#include file="../include/upfile_class.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" leftmargin="0">
<title></title>
</head>
<body style="font-size:12px;">
<%'==============================================================
'程序名称:茂盛网站管理系统(Maoin CSM)
'当前版本:Maosin CMS Version 1.1   Powered by maosin.com
'程序作者:阿茂(李胜茂)
'网站地址:www.maosin.com   www.maosin.net
'      QQ:57861417  
'电子邮箱:maosin@163.com  maosin@maosin.com
'--------------------------------------------------------------
'Copyright (C) 2006 maosin.com All Rights Reserved.
'免费版本请在程序首页保留(Powered by:Maosin CMS)版权链接信息;
'您可以对此版本进行修改,美化,但请保留此ASP文件内的版权信息;
'茂盛设计网保留此软件的法律追究权利
'==============================================================
Dim upfile,filemaxsize,upType,Cat,urlName,sizeName,content,upMode
upType=Request("upType")
cat=Request("cat")
urlName=Request("urlName")
sizeName=Request("sizeName")
content=Request("content")
upmode=Request("upmode")
select case request("cat")
 case "news"
 	upPath="../upfile/news/"
 case "article"
	upPath="../upfile/article/"	
 case "down"
	upPath="../upfile/download/"	
 case "picture"
	upPath="../upfile/picture/"
 case "res"
 	upPath="../upfile/res/"
 case "video"
 	upPath="../upfile/video/"
 case "channel"
 	upPath="../upfile/channel/"
 case else
 	upPath=cat
end select 
abspath=Server.MapPath(upPath)
Select Case Request("uptype")
Case "pic"
	Set upfile=new UpFile_Class
	upfile.AllowExt=adminUpImgExt
	upfile.GetData(adminImgSize*1024)
	Set fso=Server.CreateObject("Scripting.FileSystemObject")
	If fso.FolderExists(abspath)=False Then
		Fso.CreateFolder(abspath)
	End IF
	set fso=nothing
	if upfile.isErr<>1 and upfile.isErr<>3 and upfile.isErr<>2  then
		isyangmin=trim(upfile.form("yangmin"))
		if isyangmin="1" then
			filename=upfile.file("myfile").filename
		else
			filename=upfile.GetNewFileName()&"."&upfile.GetFileExt(upfile.file("myfile").filename)
		end if
		fileurl=Mid(upPath,4)&filename
		upfile.SaveTofile "myfile",abspath&"\"&filename
		returnSize=countfilesize(upfile.file("myfile").filesize)
	end if
	Select Case upfile.isErr
		Case 1
			Response.Write("<div style=""height:100%;padding-top:5px;background:#DDF8FF;"">你没有上传数据,请返回上传!&nbsp;&nbsp;<a href=""#"" onclick=""window.history.go(-1);"">[重新上传]</a></div>")
		Case 2
			Response.Write("<div style=""height:100%;padding-top:5px;background:#DDF8FF;"">你上传的数据超出我们的最大限制,目前最大可上传"&adminImgSize&"&nbsp;&nbsp;<a href=""#"" onclick=""window.history.go(-1);"">[重新上传]</a></div>")
		Case 3
			Response.Write("<div style=""height:100%;padding-top:5px;background:#DDF8FF;"">你上传的文件类型不支持,目前允许上传的文件类:"&adminUpImgExt&"&nbsp;&nbsp;<a href=""#"" onclick=""window.history.go(-1);"">[重新上传]</a></div>")
		Case else
			if urlName<>"" then
				Response.Write"<script language=""javascript"">parent.document.form."&urlName&".value='"&fileurl&"';</script>"
			end if
			if sizeName<>"" then
				Response.Write"<script language=""javascript"">parent.document.form."&sizeName&".value='"&returnSize&"';</script>"
			end if
			if content<>"" then
				response.write"<script language=""javascript"">parent.oblog_Composition.document.body.innerHTML+='<img src="&upPath&filename &">'</script>"
			end if
			Response.write "<div style=""height:100%;padding-top:5px;background:#DDF8FF;"">恭喜,上传成功!文件保存在"&upPath&filename&"&nbsp;&nbsp;<a href=""#"" onclick=""window.history.go(-1);"">[继续上传]</a></div>"
	End Select
Case "file"
	Set upfile=new UpFile_Class
	upfile.AllowExt=upFileExt
		upfile.GetData(UpFileSize*1024)
	Set fso=Server.CreateObject("Scripting.FileSystemObject")
	If fso.FolderExists(abspath)=False Then
		Fso.CreateFolder(abspath)
	End IF
	set fso=nothing
	if cint(upfile.isErr)=0 then
		isyangmin=trim(upfile.form("yangmin"))
		if isyangmin="1" then
			filename=upfile.file("myfile").filename
		else
			filename=upfile.GetNewFileName()&"."&upfile.GetFileExt(upfile.file("myfile").filename)
		end if
		fileurl=Mid(upPath,4)&filename
		upfile.SaveTofile "myfile",abspath&"\"&filename
		returnSize=countfilesize(upfile.file("myfile").filesize)
	end if
	Select Case upfile.isErr
		Case 1
			Response.Write("<div style=""height:100%;padding-top:5px;background:#DDF8FF;"">你没有上传数据,请返回上传!&nbsp;&nbsp;<a href=""#"" onclick=""window.history.go(-1);"">[重新上传]</a></div>")
		Case 2
			Response.Write("<div style=""height:100%;padding-top:5px;background:#DDF8FF;"">你上传的数据超出我们的最大限制,目前最大可上传"&UpFileSize&"&nbsp;&nbsp;<a href=""#"" onclick=""window.history.go(-1);"">[重新上传]</a></div>")
		Case 3
			Response.Write("<div style=""height:100%;padding-top:5px;background:#DDF8FF;"">你上传的文件类型不支持,目前允许上传的文件类:"&upFileExt&"&nbsp;&nbsp;<a href=""#"" onclick=""window.history.go(-1);"">[重新上传]</a></div>")
		Case else
		
		if upmode="openwindow" and upmode<>"" then
			if urlName<>"" then
				Response.Write"<script language=""javascript"">window.opener.form."&urlName&".value='"&fileurl&"';</script>"
			end if
			if sizeName<>"" then
				Response.Write"<script language=""javascript"">window.opener.document.form."&sizeName&".value='"&returnSize&"';</script>"
			end if
			if content<>"" then
				response.write"<script language=""javascript"">window.opener.oblog_Composition.document.body.innerHTML+='<img src="&upPath&filename &">'</script>"
			end if		
			Response.write("文件上传成功!保存在"&upPath&filename)
			response.write"<script language=""javascript"">setTimeout('self.close()',3000);</script>"
		else
			if urlName<>"" then
				Response.Write"<script language=""javascript"">parent.document.form."&urlName&".value='"&fileurl&"';</script>"
			end if
			if sizeName<>"" then
				Response.Write"<script language=""javascript"">parent.document.form."&sizeName&".value='"&returnSize&"';</script>"
			end if
			if content<>"" then
				response.write"<script language=""javascript"">parent.oblog_Composition.document.body.innerHTML+='<img src="&upPath&filename &">'</script>"
			end if
			Response.write "<div style=""height:100%;padding-top:5px;background:#DDF8FF;"">恭喜,上传成功!文件保存在"&upPath&filename&"&nbsp;&nbsp;<a href=""#"" onclick=""window.history.go(-1);"">[继续上传]</a></div>"
		end if
	End Select
End Select
function countfilesize(objsize)
if objsize<>"" then
	countfilesize=objsize
	if countfilesize>=1024 and countfilesize<1048576 then
		countfilesize=countfilesize/1024
		countfilesize=FormatNumber(countfilesize,2,-1)&"KB"
	elseif countfilesize>=1048576 and countfilesize<1073741824 then
		countfilesize=countfilesize/1048576
		countfilesize=FormatNumber(countfilesize,2,-1)&"MB"
	else
		countfilesize=countfilesize&"byte"
	end if
else
	exit function
end if
end function
'========================================================
'MaoSin CMS 1.1      Power by maosin.com
'Email: maosin@163.com , maosin@maosin.com
'Web: http://www.maosin.com  http://www.maosin.net
'Copyright (C) 2006 maosin.com All Rights Reserved.
'========================================================
%>
</body>
</html>

⌨️ 快捷键说明

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