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

📄 upload.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文件内的版权信息;
'茂盛设计网保留此软件的法律追究权利
'==============================================================
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>茂盛设计文件上传</title>
<style>
body,table{
	margin:0px;
	font-size:12px;
}
form{margin:0px;}
</style>
</head>

<body>
<%
dim allowExt,allowSize,upPop,msgType,UserUpLoad,filePath,uptype
if session(adminVar)=adminVal then
	if request("uptype")="file" then
		allowExt=upFileExt
		allowSize=UpFileSize
		uptype="file"
	else
		allowExt=adminUpImgExt
		allowSize=adminImgSize
		uptype="img"
	end if
	filePath="../upfile/other/"
	userUpload="admin"
else
	if request("uptype")="file" then
		allowExt=userUpFileAllowExt
		allowSize=userUpFileSize
		uptype="file"
	else
		allowExt=userUpImgAllowExt
		allowSize=userUpImgSize
		uptype="img"
	end if
	if left(userUpPath,1)="/" then
		filePath=".."&userUpPath&"/"
	elseif left(userUpPath,3)="../" then
		filePath=userUpPath&"/"
	else
		filePath="../"&userUpPath&"/"
	end if
	userUpload="user"
end if
if userUpload="user" then
	if session(userVar)=userVal then
		userInfo=session("userInfo")
	else
		response.write("<font color=""#ff0000"">您没有上传文件的权限!</font>")
		response.end
	end if
	if userUpPopedom=0 then
		if cint(userInfo(2))=3 then
			upPop=true
		else
			upPop=false
			msgType=1
		end if
	elseif userUpPopedom=1 then
			upPop=true
	elseif userUpPopedom=2 then
		if cint(userInfo(2))=2 then
			upPop=true
		elseif cint(userInfo(2))=3 then
			upPop=true
		else
			upPop=false
			msgType=2
		end if
	end if
elseif userUpload="admin" then
	upPop=true
else
	upPop=false
	msgType=1
end if
if upPop=true then
	if request("action")="saveFile" then
		call saveFile(allowExt,allowSize,filePath)
	end if
	call upLoadForm(allowExt,allowSize,uptype)
else
	call UpMsg(msgType)
end if
Sub upLoadForm(allowExt,allowSize,uptype)%>
<table heiht="100%"><tr><td valign="middle">
<form action="?uptype=<%=uptype%>&action=saveFile" method="post" enctype="multipart/form-data" name="myform" id="myform">
<input name="uploadfile" type="file" id="uploadfile">
</form>
<%response.Write "类型:"&allowExt&"<br>大小:"&allowSize&"KB"%>
</td></tr></table>
<%
End Sub
Sub saveFile(fileExt,fileSize,upPath)
dim filePath,saveFilePath
saveFilePath=Server.MapPath(upPath)
Set fso=Server.CreateObject("Scripting.FileSystemObject")
If fso.FolderExists(saveFilePath)=False Then
	Fso.CreateFolder(saveFilePath)
End IF
set fso=nothing
set upfile=new upfile_class
	upfile.allowExt=fileExt
	upfile.GetData(fileSize*1024)
if upfile.isErr>0 then
select case cint(upfile.isErr)
	case 1
		Response.Write("<script>parent.UploadError('你没有上传数据!');history.back();</script>")
		exit sub
	case 2
		Response.Write("<script>parent.UploadError('你上传的数据超出我们的最大限制,目前最大可上传"&fileSize&"');history.back();</script>")
		exit sub
end select
end if
filename=upfile.GetNewFileName()&"."&upfile.GetFileExt(upfile.file("uploadfile").filename)
fileurl=Mid(upPath,4)&filename
upfile.SaveToFile "uploadfile",saveFilePath&"\"&filename
if upfile.isErr=0 then
	response.write("<script>parent.UploadSaved('" & upPath & filename & "');history.back();</script>")
else
	Response.Write("<script>parent.UploadError('你上传的文件类型不支持!');history.back();</script>")
end if
set upfile=nothing
End Sub
Sub UpMsg(showMode)
dim tempStr
if showMode=1 then
	tempStr="<table height=""100%""><tr><td valign=""middle""><form action=""?action=saveFile"" method=""post"" enctype=""multipart/form-data"" name=""myform"" id=""myform"" style=""display:none;""><input name=""uploadfile"" type=""file"" id=""uploadfile""></form><font color=""#ff0000"">上传功能已关闭</font></td></tr></table>"
elseif showMode=2 then
	tempStr="<table height=""100%""><tr><td valign=""middle""><form action=""?action=saveFile"" method=""post"" enctype=""multipart/form-data"" name=""myform"" id=""myform"" style=""display:none;""><input name=""uploadfile"" type=""file"" id=""uploadfile""></form><font color=""#ff0000"">您的上传权限不够</font></td></tr></table>"
end if
response.write tempStr
End Sub
'========================================================
'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 + -