从数据库中按顺序列出目录并显示子文件夹和文件.典型的ASP



我知道有显示文件夹和文件的windows目录的解决方案,但我的是从数据库中的虚拟目录。

到目前为止,当你点击show me按钮时,它会显示你所在的目录路径
例如
文件夹1.1.1
1.1文件夹
文件夹1

按此顺序显示,但我希望它在顶部显示主目录。我还希望能够使文件列表可点击,这样你就可以直接到一个特定的文件或文件夹,当你点击显示我按钮,使其更容易为用户找到他们想要的文件。是否有可能显示子目录而不进入它们?

我用来显示你所在目录路径的代码是:

dim previousPos 
previousPos = 0
dim html
html = ""

    if not test.BOF then
do while not objRsU.EOF
'if previousPos = (test.Fields(2)) then
response.Write html & "<br />"
html = ""
'else
html = test.Fields(0) & "" & html
'end if
previousPos = test.Fields(2)
test.MoveNext
loop
end if

set test =nothing
set try =nothing

ListFolderContents Server.MapPath("/"), 0 
sub ListFolderContents(path, level)     
    dim fs, folder, file, item, subFolders     
    set fs = CreateObject("Scripting.FileSystemObject")     
    set folder = fs.GetFolder(path)      
    if folder.SubFolders.Count > 0 or folder.Files.Count > 0 then         
    'Display the target folder and info.         
    if level > 3     then             
    Response.Write("<h2>"& folder.Name &"</h2>" & html)         
    end if  
    'Display a list of sub folders.         
    for each item in folder.SubFolders             
    ListFolderContents item.Path, level  + 1
    next          
    'Display a list of files.
     Response.Write("<a<ul></a>" & html)      
     for each item in folder.Files
     Response.Write("<li><a href=""" & test.Name & """>" & try.Name & "</a></li>")
    next         
    Response.Write("</ul>" & html)

    end if 
end sub

代码的第二部分显示了目录的Main文件夹。

任何帮助都将非常感激。

谢谢

你为什么不用这样的东西呢?它支持经典ASP.

http://ckfinder.com/

最新更新