叶子谷- 网页教程

RSS订阅 站长资讯通告:
搜索: 您现在的位置: 叶子谷 >> 技术学习 >> Asp ※ Php >> 正文

类似于iis浏览的功能_动网_社区论坛·开发者网络源动力

2008-06-10 13:50:46 来源:网络 作者:佚名 【 点击:
<!---将此文件存为folder_list.asp看看效果就知道了加上权限就可以方便自己了,--->
<
'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
>

  

Tags: 标签SY_关键字  
责任编辑:cptedu
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】   
  • 上一篇文章:
  • 下一篇文章:
  • 姓 名: * Oicq:
    评 分: 1分 2分 3分 4分 5分
    评论内容:
    设为首页 -加入收藏 - 联系我们 - 友情链接 - 版权声明 - 管理登陆