angular编写仿Explorer资源管理器 – asp的api接口

5.16 完成了 angular编写仿Explorer资源管理器(http://www.miaoqiyuan.cn/p/angular-explorer) 的 PHP版本的接口(http://www.miaoqiyuan.cn/p/web-explorer-php-api),今天把 ASP 版本的接口也放出来。

再是说一下:使用方法非常简单,只需要将 本脚本(详细代码件下方)通过FTP或 本文件传到您的 WEB 目录下(需要空间支持ASP),通过访问 http://www.miaoqiyuan.cn/products/web-explorer/ 即可。

老规矩,直接上代码(代码下载地址:http://www.miaoqiyuan.cn/products/web-explorer/asp.api.rar),代码比较简单,没有注释,基本和PHP版本的代码一样:

<% @codepage = 65001 %>
<%
	'===========================================================================
	'=                 Copyright (c) 2016 猫七(QQ:77068320)                    =
	'=                      All rights reserverd.                              =
	'===========================================================================
	'=           Web-Explorer 服务器端API接口(ASP版本)                         =
	'=  程序地址:http://www.miaoqiyuan.cn/products/web-explorer/asp.api.rar   =
	'=  前端程序:http://www.miaoqiyuan.cn/products/web-explorer/              =
	'=  使用说明:http://www.miaoqiyuan.cn/p/web-explorer-asp-api              =
	'=  邮箱地址:mqycn@126.com   QQ:77068320 1301425789                      =
	'===========================================================================
	
	password = "miaoqiyuan.cn"	'密码,如果不设置请留空
	
	function getCurrentPath()
		currentPath = request("path")
		if currentPath = "" then currentPath = "/"
		currentPath = replace(currentPath, "..", "")
		currentPath = replace(currentPath, "//", "/")
		getCurrentPath = currentPath
	end function
	
	function getIndex()
		getIndex = request("index")
		if not isnumeric(getIndex) then getIndex = 0 else getIndex = cLng(getIndex)
	end function
	
	function getCallback()
		getCallback = request("callback")
		if getCallback = "" then getCallback = "callback"
	end function
	
	function getCurrentPathValue(byval absPath)
		getCurrentPathValue = replace(split(absPath, ":")(1), split(server.mappath("/"), ":")(1), "")
		getCurrentPathValue = replace(getCurrentPathValue, "\", "/")
	end function
	
	function getFolderSize(byval fpo)
		dim allSize
		allSize = 0
		for each file in fpo.files
			allSize = allSize + file.size
		next
		for each folder in fpo.subfolders
			allSize = allSize + getFolderSize(folder)
		next
		getFolderSize = allSize
	end function
	
	sub showCallback()
		response.write getCallback()
	end sub
	
	sub showPath(byval fpo)
		
		folderId = 0
		fileId = 0
		
		showCallback
		
%>({
	path : "<% =getCurrentPathValue(fpo.path) %>",
	folder : [<%
		for each folder in fpo.subfolders
			if folderId > 0 then
				response.write ","
			end if
			folderId = folderId + 1
			
%>
		{name : "<% = folder.name %>"}<%
		next
%>
	],
	file : [<%
		for each file in fpo.files
			if fileId > 0 then
				response.write ","
			end if
			fileId = fileId + 1
%>
			{name : "<% = file.name %>", size : "<% = file.size %>"}<%
		next
%>
	]
});
<%
	end sub
	
	sub showFolderSize(byval fpo)
		showCallback
		
%>({
	parent : "<% =getCurrentPathValue(fpo.parentfolder.path) %>",
	path : "<% =getCurrentPathValue(fpo.path) %>",
	index : <% = getIndex() %>,
	size : <% = getFolderSize(fpo) + 1 %>
});
<%
	end sub
	
	if password <> "" and request("pwd") <> password then
		showCallback
%>({err: "密码错误"});
<%
		response.end
	end if
	
	set fso = server.createobject("Scripting.FileSystemObject")
	absPath = server.mappath(getCurrentPath())
	if fso.folderexists(absPath) then 
		set fpath = fso.getfolder(absPath)
	else
		set fpath = fso.getfolder(server.mappath("/"))
	end if
	
	if request("action") = "getsize" then
		call showFolderSize(fpath)
	else
		call showPath(fpath)
	end if
%>

发表评论

电子邮件地址不会被公开。 必填项已用*标注