Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Please Help With Hyperlinks

    Hello. I am new to this forum. I am not a web developer, but I am willing to learn. I am a network tech. So here is what I need to do: I need to be able to list and sort by date some files in a folder on another page. I also need the file names to be hyperlinked to the actual file so that the people can download the file.

    Our emergency preparedness director will release press releases and put them in a folder. I need this page to update every time he puts something new in. I already found some code that will do everything that I need to do, except put the hyperlink back to the file. The code that I found can be seen here: http://www.aspfaqs.com/ASPScripts/P...Q.asp?FAQID=118. I have also attached the code in a txt file to this message.

    If anyone can tell me what I need to do to get hyperlinks to work, I would appreciate it. Thank you.

    Rusty Painter
    rpainter@dorchestercounty.net
    Attached Files Attached Files

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Change just one line:

    Code:
    Response.Write "    <TD>" & theFiles(i)(j) & "</TD>" & vbNewLine
    
    to 
    
    Response.Write "    <td><a href=""" & DIRECTORY & "/" & theFiles(i)(j) & """>" & theFiles(i)(j) & "</a></td>" & vbNewLine
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Roy, you are the man. Thank you. That worked. The only problem now is that every column is hyperlinked. Is there any way to just make the "File Name" column hyperlinked? If not, I can live with this. Thanks again. I have attached a screenshot of the webpage to show you what I am talking about.

    Rusty
    Attached Files Attached Files

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Slight code change:

    Code:
    if j > 0 then
         Response.Write "    <TD>" & theFiles(i)(j) & "</TD>" & vbNewLine
    else
         Response.Write "    <td><a href=""" & DIRECTORY & "/" & theFiles(i)(j) & """>" & theFiles(i)(j) & "</a></td>" & vbNewLine
    end if
    Restores the original line, except when it's the filename being displayed, then it adds the hyperlink.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #5
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Thanks for all of your help. That is perfect. I might get this stuff one day.

  • #6
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi there

    Sorry to butt in here. I am having a problem getting this code to work. I have changed the line:

    path = Server.MapPath(DIRECTORY)

    to:

    path = Server.MapPath(C:/Documents)

    but when I view the page there are no files listed. Does anyone know what I am doing wrong? The folder Documents has subfolders which in turn may have subfolders, is this the problem?

    Any help greatly appreciated

  • #7
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I just tried what you said. First you need to change:

    path = Server.MapPath(C:/Documents)

    back to:

    path = Server.MapPath(DIRECTORY)

    What you do change is on line 11 the CONST DIRECTORY. This needs to be a relative path.

    Also, I tried to put a subfolder with some files in the directory. This did not show up. Only the files in the directory showed up.

    Hope this helps.

  • #8
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the info. I have tried changing those lines and it still doesn't display anything so I will have to figure out a way to have it displaying the subfolders.

    I have tried the code from the 'sticky' post above and it isn't doing it but it looks to be more what I need.

    Oh well I'll keep trying.

    Thanks again.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •