<
'const_domain_name为域名最后不要加斜杠
constconst_domain_name="http://localhost"
>
<style>
b,img,a{font-size:9pt;line-height:150;text-decoration:none;color:#0000cc;}
span{font-size:12pt;}
</style>
<
'------------------------------------------------显示当前目录下的子目录和文件
sublist
Dimfso,f,f1,fc,s
Setfso=CreateObject("Scripting.FileSystemObject")
Setf=fso.GetFolder(server.MapPath("."))
setfs=f.SubFolders
Setfc=f.Files
ForEachfssinfs
dimfolder_name
folder_name=fss.name
>
<ahref="folder_list.asp?act=list_cur&cur_path=<=fss>"><spanstyle="font-family:wingdings">0</span><=folder_name></a><br>
<
Next
>
<
ForEachf1infc
dimfilename
filename=f1.name
>
<ahref="<=p2v_path(f1)>"><spanstyle="font-family:wingdings2">/</span><=filename></a><br>
<
Next
setfso=nothing
endsub
>
<
'------------------------------------------------显示指定路径下的目录和文件
sublist_cur
Dimfso,f,f1,fc,s
Setfso=CreateObject("Scripting.FileSystemObject")
Setf=fso.GetFolder(request("cur_path"))
setfs=f.SubFolders
Setfc=f.Files
ForEachfssinfs
dimfolder_name
folder_name=fss.name
>
<ahref="folder_list.asp?act=list_cur&cur_path=<=fss>"><spanstyle="font-family:wingdings">0</span><=folder_name></a><br>
<
Next
>
<
ForEachf1infc
dimfilename
filename=f1.name
>
<ahref="<=p2v_path(f1)>"><spanstyle="font-family:wingdings2">/</span><=filename></a><br>
<
Next
setfso=nothing
endsub
>
<
'------------------------------------------------显示上级目录的子目录和子文件
sublist_parent
onerrorresumenext
Dimfso,f,f1,fc,s
Setfso=CreateObject("Scripting.FileSystemObject")
Setf=fso.GetFolder(display_cur_path)
setfs=f.SubFolders
Setfc=f.Files
ForEachfssinfs
dimfolder_name
folder_name=fss.name
>
<ahref="folder_list.asp?act=list_cur&cur_path=<=fss>"><spanstyle="font-family:wingdings">0</span><=folder_name></a><br>
<
Next
>
<
ForEachf1infc
dimfilename
filename=f1.name
>
<ahref="<=p2v_path(f1)>"><spanstyle="font-family:wingdings2">/</span><=filename></a><br>
<
Next
setfso=nothing
onerrorgoto0
endsub
'---------------------------------------------得到上级目录的路径
functionget_parent_folder()
onerrorresumenext
str=display_cur_path
str_find="\"
str_int=InStrRev(str,str_find)-1'得到上一级目录的路径
get_parent_folder=mid(str,1,str_int)
err.clear
endfunction
'-----------------------------------------------将文件路径转为www发布的路径这样就可以下载了
functionp2v_path(p_path)
'p_path为硬盘上的物理路径
dimhost
host=lcase(server.MapPath("\"))
p_path=lcase(p_path)
p2v_path=replace(p_path,host,const_domain_name)
endfunction
'-----------------------------------------------显示当前所在的路径
functiondisplay_cur_path()
cur_path=request("cur_path")
ifcur_path=""then
display_cur_path=server.MapPath(".")
else
display_cur_path=cur_path
endif
setfso=nothing
endfunction
submain
>
<ahref="folder_list.asp?act=list_parent&cur_path=<=get_parent_folder>">向上</a><b><ahref="javascript:void(null)"><=display_cur_path></a></B><p>
<
selectcaserequest("act")
case"list_parent"
list_parent
case"list_cur"
list_cur
caseelse
list
endselect
endsub
main
>

RSS订阅







