帝国软件
  设为首页 加入收藏 关于我们
 
解密帝国网站管理系统
栏 目:
 
您的位置:首页 > 技术文档 > ASP编程
类似于iis浏览的功能
作者:asp.net 发布时间:2005-03-12 来源:开发者俱乐部
<!---将此文件存为folder_list.asp看看效果就知道了加上权限就可以方便自己了,--->
<%
'const_domain_name为域名最后不要加斜杠
const const_domain_name="http://localhost"
%>
<style>
b,img,a{font-size:9pt;line-height:150%;text-decoration:none;color:#0000cc;}
span{font-size:12pt;}
</style>

<%
'------------------------------------------------显示当前目录下的子目录和文件
sub list
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(server.MapPath("."))
set fs=f.SubFolders
Set fc =f.Files

For Each fss in fs
dim folder_name
folder_name=fss.name
%>
<a href="folder_list.asp?act=list_cur&cur_path=<%=fss%>"><span style="font-family:wingdings">0</span><%=folder_name%></a><br>
<%
Next

%>
<%
For Each f1 in fc
dim filename
filename=f1.name
%>
<a href="<%=p2v_path(f1)%>"><span style="font-family:wingdings 2">/</span><%=filename%></a><br>
<%
Next

set fso=nothing
end sub
%>


<%
'------------------------------------------------显示指定路径下的目录和文件
sub list_cur
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(request("cur_path"))
set fs=f.SubFolders
Set fc =f.Files

For Each fss in fs
dim folder_name
folder_name=fss.name
%>
<a href="folder_list.asp?act=list_cur&cur_path=<%=fss%>"><span style="font-family:wingdings">0</span><%=folder_name%></a><br>
<%
Next

%>


<%
For Each f1 in fc
dim filename
filename=f1.name
%>
<a href="<%=p2v_path(f1)%>"><span style="font-family:wingdings 2">/</span><%=filename%></a><br>
<%
Next
set fso=nothing
end sub
%>

<%
'------------------------------------------------显示上级目录的子目录和子文件
sub list_parent
on error resume next
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(display_cur_path)
set fs=f.SubFolders
Set fc =f.Files

For Each fss in fs
dim folder_name
folder_name=fss.name

%>
<a href="folder_list.asp?act=list_cur&cur_path=<%=fss%>"><span style="font-family:wingdings">0</span><%=folder_name%></a><br>
<%

Next

%>

<%
For Each f1 in fc
dim filename
filename=f1.name
%>
<a href="<%=p2v_path(f1)%>"><span style="font-family:wingdings 2">/</span><%=filename%></a><br>
<%
Next
set fso=nothing
on error goto 0
end sub

'---------------------------------------------得到上级目录的路径
function get_parent_folder()
on error resume next
str=display_cur_path
str_find=""
str_int=InStrRev (str,str_find)-1 '得到上一级目录的路径
get_parent_folder=mid(str,1,str_int)
err.clear
end function


'-----------------------------------------------将文件路径转为www发布的路径这样就可以下载了
function p2v_path(p_path)
'p_path为硬盘上的物理路径
dim host
host=lcase(server.MapPath(""))
p_path=lcase(p_path)
p2v_path=replace(p_path,host,const_domain_name)
end function

'-----------------------------------------------显示当前所在的路径
function display_cur_path()
cur_path=request("cur_path")
if cur_path="" then
display_cur_path=server.MapPath(".")
else
display_cur_path=cur_path
end if
set fso=nothing
end function

sub main
%>
<a href="folder_list.asp?act=list_parent&cur_path=<%=get_parent_folder%>">向上</a> <b><a href="javascript:void(null)"><%=display_cur_path%></a></B><p>
<%

select case request("act")
case "list_parent"
list_parent
case "list_cur"
list_cur
case else
list
end select
end sub


main
%>

  
评论】【加入收藏夹】【 】【打印】【关闭
※ 相关链接
无相关信息

   栏目导行
  PHP编程
  ASP编程
  ASP.NET编程
  JAVA编程
   站点最新
·致合作伙伴的欢迎信
·媒体报道
·帝国软件合作伙伴计划协议
·DiscuzX2.5会员整合通行证发布
·帝国CMS 7.0版本功能建议收集
·帝国网站管理系统2012年授权购买说
·PHPWind8.7会员整合通行证发布
·[官方插件]帝国CMS-访问统计插件
·[官方插件]帝国CMS-sitemap插件
·[官方插件]帝国CMS内容页评论AJAX分
   类别最新
·在ASP中使用数据库
·使用ASP脚本技术
·通过启动脚本来感受ASP的力量
·学习使用ASP对象和组件
·解析asp的脚本语言
·初看ASP-针对初学者
·ASP开发10条经验总结
·ASP之对象总结
·ASP与数据库应用(给初学者)
·关于学习ASP和编程的28个观点
 
关于帝国 | 广告服务 | 联系我们 | 程序开发 | 网站地图 | 留言板 帝国网站管理系统