ASP目录遍历
13 十 2005
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<% set fso = CreateObject("Scripting.FileSystemObject") targetPath=".. ext" uploadPath = server.mappath(targetPath) Set uploadfolder = fso.GetFolder(uploadPath) set allfiles = uploadfolder.Files for each fileitem in allfiles sFileName = fileitem.Name ''判断文件类型 if right(sfilename,3)="png" _ or right(sfilename,3)="bmp" _ or right(sfilename,4)="aspx" _ or right(sfilename,3)="mid" _ or right(sfilename,3)="amr" _ or right(sfilename,3)="txt" _ or right(sfilename,4)="html" _ or right(sfilename,3)="htm" _ or right(sfilename,3)="jpg" _ or right(sfilename,3)="gif" _ or right(sfilename,3)="asp" _ then response.write "<a href='"&targetPath&sFileName&"' target=_blank>"&sFileName&"</a><br>" end if next %> |