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

📄 upfile.asp

📁 本系统是一套开源WEB的网站管理系统
💻 ASP
字号:
<!--#include file="include/config.asp"-->
<!--#include file="include/upfile_class.asp"-->
<%
'==============================================================
'程序名称:茂盛网站管理系统(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文件内的版权信息;
'茂盛设计网保留此软件的法律追究权利
'==============================================================
if session(userVar)=userVal then
	userInfo=session("userInfo")
else
	response.write("<script type=""text/javascript"">window.history.go(-1);</script>")
	response.end
end if
if userUpPopedom=0 then
	if cint(userInfo(2))<>3 then
		response.write("<script type=""text/javascript"">window.history.go(-1);</script>")
		response.end
	end if
elseif userUpPopedom=2 then
	if cint(userInfo(2))<>2 or cint(userInfo(2))<>3 then
		response.write("<script type=""text/javascript"">window.history.go(-1);</script>")
		response.end
	end if
end if
dim upfileobj,fileMaxsize,errmsg,errNum,UpPath
upType=Request("upType")
urlName=Request("urlName")
sizeName=Request("sizeName")
content=Request("content")
if uptype="file" then
	userUpExt=userUpFileAllowExt
	userUpSize=userUpFileSize
else
	userUpExt=userUpImgAllowExt
	userUpSize=userUpImgSize
end if
upPath=server.mapPath(userUpPath)
Set fso=Server.CreateObject("Scripting.FileSystemObject")
If fso.FolderExists(upPath)=False Then
	Fso.CreateFolder(upPath)
End IF
set fso=nothing
call saveData
Sub saveData()
set upfileobj=new upfile_class
upfileobj.AllowExt=userUpExt
upfileobj.GetData(userUpSize*1024)
Select Case cint(upfileobj.isErr)
	Case 1
		response.write("<table height=""100%"" style=""margin:0px;padding:0px;font-size:12px;""><tr><td valign=""middle"">你没有上传数据呀! [<a href=# onClick='window.history.go(-1)'>返回重新上传</a>]</td></tr></table>")
		exit sub
	Case 2
		response.write("<table height=""100%"" style=""margin:0px;padding:0px;font-size:12px;""><tr><td valign=""middle"">您上传的数据超出我们的限制啦! [<a href=# onClick='window.history.go(-1)'>返回重新上传</a>]</td></tr></table>")
		exit sub
	Case 3
		response.write("<table height=""100%"" style=""margin:0px;padding:0px;font-size:12px;""><tr><td valign=""middle"">该类型文件不允许上传! [<a href=# onClick='window.history.go(-1)'>返回重新上传</a>]</td></tr></table>")
		exit sub
	case else
End Select
fileExt="."&upfileobj.GetFileExt(upfileobj.file("upfile").filename)
fileName=upfileobj.GetNewFileName()'取得随机文件名
fileUrl=userUpPath&"/"&fileName&fileExt
upfileobj.saveToFile "upfile",upPath&"\"&fileName&fileExt
returnSize=countfilesize(upfileobj.file("upfile").filesize)
if upfileobj.isErr>0 then
	response.write("<table height=""100%"" style=""margin:0px;padding:0px;font-size:12px;""><tr><td valign=""middle"">该类型文件不允许上传! [<a href=# onClick='window.history.go(-1)'>返回重新上传</a>]</td></tr></table>")
	exit sub
else
	if urlName<>"" then
	Response.Write"<script language=""javascript"">parent.document."&urlName&".value='"&fileUrl&"';</script>"
	end if
	if content<>"" then
		response.write("<script language=""javascript"">parent.oblog_Composition.document.body.innerHTML+='<img src="&fileUrl&">'</script>")
	end if
	if sizeName<>"" then
		Response.Write"<script language=""javascript"">parent.document."&sizeName&".value='"&returnSize&"';</script>"
	end if
	response.write("<table height=""100%"" style=""margin:0px;padding:0px;font-size:12px;""><tr><td valign=""middle"">文件上传成功啦! 保存在"&fileUrl&"[<a href=# onClick='window.history.go(-1)'>返回继续上传</a>]</td></tr></table>")
end if
End Sub
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.
'========================================================
%>

⌨️ 快捷键说明

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