欢迎光临
我们一直在努力

类似于iis浏览的功能

建站超值云服务器,限时71元/月

<!—将此文件存为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

%>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 类似于iis浏览的功能
分享到: 更多 (0)

相关推荐

  • 暂无文章