How to list the contents of a folder on an ASP page and make the list clickable.

Discussion in 'ASP General' started by mallyonline, Oct 11, 2005.

  1. mallyonline

    mallyonline Guest

    Thank you for your previous help.



    I posted regarding listing the names of files held in a folder on the server
    and making the

    list appear clickable. This has now been accomplished. The files are
    listed - The files are clickable -



    There would appear to be a problem now in that the files do not open and run
    as they otherwise would do on any standard directory browsing page.



    When the link is clicked, rather than open the file and play in a media
    player what actually happens is a new browser window tries to open
    objFl.Name which obviously it cannot.



    The Work Around:

    I now have the server open a new window that allows directory browsing. This
    is just a temporary measure to get a list of files that open in any media
    player. I would obviously like it if the code would open a media player
    possibly even in a new frame this would allow me to see the files and have
    them play in another frame at the same time as browsing.



    I have posted this message before and received no reply so I am apologizing
    in advance for this; however since I have not had a reply I felt it
    necessary to post again to the group.



    The code: I have decided to leave the code out of this message. What I will
    say is that anyone who has a genuine interest in what I am trying to achieve
    here is free to post there interest / or email me in private to




    If you could help on this I would be much appreciative.

    Kind Regards

    Malcolm
     
    mallyonline, Oct 11, 2005
    #1
    1. Advertising

  2. mallyonline

    Curt_C [MVP] Guest

    RE: How to list the contents of a folder on an ASP page and make the l

    Sadly, you'll have to show the code, but really only the lines that write the
    link to the page.

    Most likely you are "" (quoting) it incorectly so you are getting the
    literal objName instead of the value.

    --
    Curt Christianson
    site: http://www.darkfalz.com
    blog: http://blog.darkfalz.com



    "mallyonline" wrote:

    > Thank you for your previous help.
    >
    >
    >
    > I posted regarding listing the names of files held in a folder on the server
    > and making the
    >
    > list appear clickable. This has now been accomplished. The files are
    > listed - The files are clickable -
    >
    >
    >
    > There would appear to be a problem now in that the files do not open and run
    > as they otherwise would do on any standard directory browsing page.
    >
    >
    >
    > When the link is clicked, rather than open the file and play in a media
    > player what actually happens is a new browser window tries to open
    > objFl.Name which obviously it cannot.
    >
    >
    >
    > The Work Around:
    >
    > I now have the server open a new window that allows directory browsing. This
    > is just a temporary measure to get a list of files that open in any media
    > player. I would obviously like it if the code would open a media player
    > possibly even in a new frame this would allow me to see the files and have
    > them play in another frame at the same time as browsing.
    >
    >
    >
    > I have posted this message before and received no reply so I am apologizing
    > in advance for this; however since I have not had a reply I felt it
    > necessary to post again to the group.
    >
    >
    >
    > The code: I have decided to leave the code out of this message. What I will
    > say is that anyone who has a genuine interest in what I am trying to achieve
    > here is free to post there interest / or email me in private to
    >
    >
    >
    >
    > If you could help on this I would be much appreciative.
    >
    > Kind Regards
    >
    > Malcolm
    >
    >
    >
     
    Curt_C [MVP], Oct 11, 2005
    #2
    1. Advertising

  3. mallyonline

    mallyonline Guest

    Re: How to list the contents of a folder on an ASP page and make the l

    Thank you for showing your interest.

    Keeping in mind that i have made changes to allow for the page to be browsed
    by directory from the server.(IIS6)

    The Code:
    <%
    Dim objFSO,objFldr,objFl, sPath
    sPath = "Local Drive:\Inetpub\wwwroot\folder contents"
    Set objFSO=Server.CreateObject("Scripting.FileSystemObject")
    Set objFldr=objFSO.GetFolder(sPath)
    For Each objFl in objFldr.Files
    'Print the name of all files in the folder

    Response.Write "<a href=""mp3/"" target=""_main"">" & objFl.Name & "</a><br
    />"
    Next
    Set objFldr=Nothing
    Set objFSO=Nothing
    %>


    "Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
    news:D...
    > Sadly, you'll have to show the code, but really only the lines that write
    > the
    > link to the page.
    >
    > Most likely you are "" (quoting) it incorectly so you are getting the
    > literal objName instead of the value.
    >
    > --
    > Curt Christianson
    > site: http://www.darkfalz.com
    > blog: http://blog.darkfalz.com
    >
    >
    >
    > "mallyonline" wrote:
    >
    >> Thank you for your previous help.
    >>
    >>
    >>
    >> I posted regarding listing the names of files held in a folder on the
    >> server
    >> and making the
    >>
    >> list appear clickable. This has now been accomplished. The files are
    >> listed - The files are clickable -
    >>
    >>
    >>
    >> There would appear to be a problem now in that the files do not open and
    >> run
    >> as they otherwise would do on any standard directory browsing page.
    >>
    >>
    >>
    >> When the link is clicked, rather than open the file and play in a media
    >> player what actually happens is a new browser window tries to open
    >> objFl.Name which obviously it cannot.
    >>
    >>
    >>
    >> The Work Around:
    >>
    >> I now have the server open a new window that allows directory browsing.
    >> This
    >> is just a temporary measure to get a list of files that open in any media
    >> player. I would obviously like it if the code would open a media player
    >> possibly even in a new frame this would allow me to see the files and
    >> have
    >> them play in another frame at the same time as browsing.
    >>
    >>
    >>
    >> I have posted this message before and received no reply so I am
    >> apologizing
    >> in advance for this; however since I have not had a reply I felt it
    >> necessary to post again to the group.
    >>
    >>
    >>
    >> The code: I have decided to leave the code out of this message. What I
    >> will
    >> say is that anyone who has a genuine interest in what I am trying to
    >> achieve
    >> here is free to post there interest / or email me in private to
    >>
    >>
    >>
    >>
    >> If you could help on this I would be much appreciative.
    >>
    >> Kind Regards
    >>
    >> Malcolm
    >>
    >>
    >>
     
    mallyonline, Oct 11, 2005
    #3
  4. mallyonline

    Bob Lehmann Guest

    Re: How to list the contents of a folder on an ASP page and make the l

    I don't do the double quote thing - too confusing keeping track of them,
    but....
    Response.Write "<a href='mp3/" & objFl.Name & "' target='_main'>" &
    objFl.Name & "</a><br/>"

    The filename needs to be part of the href attribute.

    Bob Lehmann

    "mallyonline" <> wrote in message
    news:dihai0$pl0$-infra.bt.com...
    > Thank you for showing your interest.
    >
    > Keeping in mind that i have made changes to allow for the page to be

    browsed
    > by directory from the server.(IIS6)
    >
    > The Code:
    > <%
    > Dim objFSO,objFldr,objFl, sPath
    > sPath = "Local Drive:\Inetpub\wwwroot\folder contents"
    > Set objFSO=Server.CreateObject("Scripting.FileSystemObject")
    > Set objFldr=objFSO.GetFolder(sPath)
    > For Each objFl in objFldr.Files
    > 'Print the name of all files in the folder
    >
    > Response.Write "<a href=""mp3/"" target=""_main"">" & objFl.Name &

    "</a><br
    > />"
    > Next
    > Set objFldr=Nothing
    > Set objFSO=Nothing
    > %>
    >
    >
    > "Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
    > news:D...
    > > Sadly, you'll have to show the code, but really only the lines that

    write
    > > the
    > > link to the page.
    > >
    > > Most likely you are "" (quoting) it incorectly so you are getting the
    > > literal objName instead of the value.
    > >
    > > --
    > > Curt Christianson
    > > site: http://www.darkfalz.com
    > > blog: http://blog.darkfalz.com
    > >
    > >
    > >
    > > "mallyonline" wrote:
    > >
    > >> Thank you for your previous help.
    > >>
    > >>
    > >>
    > >> I posted regarding listing the names of files held in a folder on the
    > >> server
    > >> and making the
    > >>
    > >> list appear clickable. This has now been accomplished. The files are
    > >> listed - The files are clickable -
    > >>
    > >>
    > >>
    > >> There would appear to be a problem now in that the files do not open

    and
    > >> run
    > >> as they otherwise would do on any standard directory browsing page.
    > >>
    > >>
    > >>
    > >> When the link is clicked, rather than open the file and play in a media
    > >> player what actually happens is a new browser window tries to open
    > >> objFl.Name which obviously it cannot.
    > >>
    > >>
    > >>
    > >> The Work Around:
    > >>
    > >> I now have the server open a new window that allows directory browsing.
    > >> This
    > >> is just a temporary measure to get a list of files that open in any

    media
    > >> player. I would obviously like it if the code would open a media player
    > >> possibly even in a new frame this would allow me to see the files and
    > >> have
    > >> them play in another frame at the same time as browsing.
    > >>
    > >>
    > >>
    > >> I have posted this message before and received no reply so I am
    > >> apologizing
    > >> in advance for this; however since I have not had a reply I felt it
    > >> necessary to post again to the group.
    > >>
    > >>
    > >>
    > >> The code: I have decided to leave the code out of this message. What I
    > >> will
    > >> say is that anyone who has a genuine interest in what I am trying to
    > >> achieve
    > >> here is free to post there interest / or email me in private to
    > >>
    > >>
    > >>
    > >>
    > >> If you could help on this I would be much appreciative.
    > >>
    > >> Kind Regards
    > >>
    > >> Malcolm
    > >>
    > >>
    > >>

    >
    >
     
    Bob Lehmann, Oct 12, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RJN
    Replies:
    1
    Views:
    1,937
    =?Utf-8?B?U2NvdHQgU2ltb25z?=
    Sep 27, 2004
  2. Paul W
    Replies:
    9
    Views:
    674
    Alex Homer
    Oct 3, 2004
  3. mi
    Replies:
    4
    Views:
    13,647
    dorayme
    May 21, 2008
  4. mogwaii
    Replies:
    9
    Views:
    2,555
    mogwaii
    Dec 8, 2010
  5. john
    Replies:
    2
    Views:
    247
Loading...

Share This Page