Subject: display names of the files as links
Posted By: europhreak Post Date: 2/15/2006 10:16:49 PM
i have a folder "uploads" with text documents in it. how can i display the names of the files as links so that the user can view the page and see all the links and when clicked on the link the text file will open.

please help asap!! please

Reply By: Steweb Reply Date: 2/20/2006 6:09:03 PM
Hi

... see that !


Dim fso, sRoot 
Set fso = Server.CreateObject("Scripting.FileSystemObject") 
sRoot = Server.MapPath("/")
 buildTree(sRoot) 
  Function buildTree(path)
     Dim dl, d, fl, f  
     Set dl = fso.GetFolder(path).SubFolders 
          Response.Write "<ul>" 
            For Each d In dl  
               Response.Write "<li>" & d.Name & "</li>"   
               Response.Write "<ul>"  
                   Set fl = fso.GetFolder(d.path).Files  
                        For Each f In fl     
                         Response.Write "<A HREF='"& Replace(f.path, sRoot, "") & "'"">" & _ 
                                             "<li>" & f.Name & "</A><br>" 
                        Next  
                   Set fl = Nothing  
               Response.Write "</ul>"   
          
               buildTree(d.Path)  
            Next 
            Set dl = Nothing 
              Response.Write "</ul>"  
     End Function 
 Set fso = Nothing
     
     %>



Steweb





Visit my web site !
www.steweb.net

Go to topic 40253

Return to index page 364
Return to index page 363
Return to index page 362
Return to index page 361
Return to index page 360
Return to index page 359
Return to index page 358
Return to index page 357
Return to index page 356
Return to index page 355