Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 15th, 2006, 11:16 PM
Authorized User
 
Join Date: Sep 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default display names of the files as links

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

 
Old February 20th, 2006, 07:09 PM
Authorized User
 
Join Date: Feb 2006
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

... see that !


Code:
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 "[list]" 
            For Each d In dl  
               Response.Write "<li>" & d.Name & "</li>"   
               Response.Write "[list]"  
                   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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Get files with 001, 002, 003 aso. names.. Rafter Visual Basic 2005 Basics 1 March 15th, 2007 06:20 AM
Display only names starting with particular letter cookout XSLT 1 June 27th, 2006 11:23 AM
Display images dynamically based on links stored khalidone Crystal Reports 4 September 22nd, 2004 02:26 PM
Headers to Open and display files AAA PHP How-To 1 March 17th, 2004 09:31 PM
Display names of open workbooks in a MsgBox rmcc Excel VBA 1 November 11th, 2003 05:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.