<% 'decleration dim folderName 'Folder Name dim fso ' File System Object dim fldr ' folder object dim objFile dim lastFolder dim pathToFile dim f 'file Object dim i,o,p 'counters dim buildFolders dim imageUrl dim sf 'sub Folders dim f1 'files in sub folder dim vpath ' virtual path dim result dim blnImages dim imgFolderFlag dim x '----------------------------------------- 'the folder name from queryString folderName = request.queryString("folderName") 'security blnImages = split(folderName,"\") if folderName <> "" then for x = 0 to ubound(blnImages) if blnImages(x) = "images" then imgFolderFlag = true exit for end if next if imgFolderFlag <> true then response.write "
You are not authorized to view the files
" response.end end if end if if folderName="" then call getFilesByFolder(basePath,"images") else call getFilesByFolder(folderName,"") end if sub getFilesByFolder(Bpath,folderName) 'file System Object Set fso = CreateObject("Scripting.FileSystemObject") Set fldr = fso.GetFolder(Bpath & folderName) response.write "" i=0 'loop over files For Each objFile in fldr.Files 'split to get file name objFile = split(objFile,"\") lastFolder = ubound(objFile) 'file size pathToFile = Bpath & folderName & "\" & objFile(lastFolder) Set f = fso.GetFile(pathToFile) 'arrange pictures in a table if objFile(lastFolder) = "header.txt" then response.write "
Folder "& objFile(lastFolder-1) & " description:
" & readTextFile(Bpath & folderName & "\header.txt") & "
" else response.write "" end if end if buildFolders = "" '3 pictures in result = i mod howManyPicsInRow if i > howManyPicsInRow-1 and result=0 then response.write "" end if next if i<>"" or i<>0 then response.write "
" if objFile(lastFolder)<> "folder.gif" then 'counter for pictures i = i + 1 vpath = split(Bpath,"\") 'converting to virtual path to display image for o = 0 to ubound(vpath) if vpath(o) = "images" then exit for end if next for p = o+1 to ubound(vpath) buildFolders = buildFolders & vpath(p) & "/" next imageUrl = Bvpath & buildFolders response.write "
" & "
" & objFile(lastFolder) if f.name<>"folder.gif" then response.write " (" & mid(f.size,1,2) & "K" & ")" end if response.write "
"& i & " files were found


" else response.write "
No files were found


back
" end if response.write "
" response.write "
Browse Folders:
" 'sub folders Set sf = fldr.SubFolders For Each f1 in sf response.write" " & "" & f1.name & "
" Next response.write "
back" response.write "
" end sub %>