www.gusucode.com > WapEditFile手机WAP文件管理器源码 > wap_folderbrowsepost.asp
<!--#include file="wap_common.asp"--> <!--#include file="wap_check.asp"--> <!--#include file="wap_verify.asp"--> <%Response.ContentType="text/vnd.wap.wml; charset=utf-8"%> <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <head><meta http-equiv='Cache-Control' content='no-cache'/> </head> <card id='wuyumin' title='遍历文件夹(浏览)'> <p> <!--#include file="wap_top.asp"--> <!--#include file="wap_top_end.asp"--> </p> <p> <% Function f_size(fsize) if fsize<1024 then f_size=fsize&"Bytes" elseif fsize<1048576 then f_size=round(fsize/1024,2)&"KB" else f_size=round(fsize/1048576,3)&"MB" end if End Function page=trim(request.querystring("page")) FolderPath=trim(request("FolderPath")) pagesize=10 if page="" or not isnumeric(page) then page=1 else page=int(page) end if Set fso=Server.CreateObject("Scripting.FileSystemObject") response.Write "相对路径:"&FolderPath&"<br/>" response.Write "<a href='wap_filebrowsepost.asp?FolderPath="&FolderPath&"'>当前相对路径下文件</a><br/>" response.write "【子文件夹列表】<br/>" YesFolder=server.MapPath(FolderPath)'相对路径 'on error resume next Set MyFolder=fso.GetFolder(YesFolder) '读取某目录中的子文件列表 Set allFolders=MyFolder.Subfolders filenum=allFolders.count pagenum=int(filenum/pagesize) if filenum mod pagesize>0 then pagenum=pagenum+1 end if if page>pagenum then page=1 end if i=0 For Each Folderitem In allFolders sFolderName=Folderitem.Name i=i+1 if i>(page-1)*pagesize and i<=page*pagesize then dim SubfolderPath if right(FolderPath,1)="/" then SubfolderPath=FolderPath else SubfolderPath=FolderPath&"/" end if response.write " "&sFolderName&" ("&f_size(Folderitem.size)&")<br/><a href='wap_folderbrowsepost.asp?FolderPath="&SubfolderPath&sFolderName&"'>子文件夹</a>|<a href='wap_filebrowsepost.asp?FolderPath="&SubfolderPath&sFolderName&"'>目录下文件</a><br/>" elseif i>page*pagesize then exit for end if next if filenum<>0 then if page>1 then response.write "<a href='wap_folderbrowsepost.asp?page=1&FolderPath="&request("FolderPath")&"'>首页</a> <a href='wap_folderbrowsepost.asp?page="&page-1&"&FolderPath="&request("FolderPath")&"'>上页</a> " else response.write "首页 上页 " end if if page<i/pagesize then response.write "<a href='wap_folderbrowsepost.asp?page="&page+1&"&FolderPath="&request("FolderPath")&"'>下页</a> <a href='wap_folderbrowsepost.asp?page="&pagenum&"&FolderPath="&request("FolderPath")&"'>尾页</a>" else response.write "下页 尾页" end if response.write "<br/>(当前第"&page&"页,共"&pagenum&"页)" response.write "<br/>(共"&filenum&"个子文件夹)" if i/pagesize>1 then response.write "<input name='a' emptyok='false' value='2' format='*N'/><anchor>转到指定页GO<go href='wap_folderbrowsepost.asp?page=$(a:N)&FolderPath="&request("FolderPath")&"'></go></anchor><br/>"&chr(13) end if else response.write "没有子文件夹<br/>" end if set MyFolder=nothing set allFolders=nothing %> </p> <p> <!--#include file="wap_footer_head.asp"--> <!--#include file="wap_footer.asp"--> </p> </card> </wml>