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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mallyonline

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

    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
    user.response@b tconnect.com



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

    Kind Regards

    Malcolm


  • Curt_C [MVP]

    #2
    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



    "mallyonlin e" wrote:
    [color=blue]
    > 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
    > user.response@b tconnect.com
    >
    >
    >
    > If you could help on this I would be much appreciative.
    >
    > Kind Regards
    >
    > Malcolm
    >
    >
    >[/color]

    Comment

    • mallyonline

      #3
      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.C reateObject("Sc ripting.FileSys temObject")
      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_da rkfalz.com> wrote in message
      news:D8B5B576-6433-4353-9830-B15CC6AACDBC@mi crosoft.com...[color=blue]
      > 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
      >
      >
      >
      > "mallyonlin e" wrote:
      >[color=green]
      >> 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
      >> user.response@b tconnect.com
      >>
      >>
      >>
      >> If you could help on this I would be much appreciative.
      >>
      >> Kind Regards
      >>
      >> Malcolm
      >>
      >>
      >>[/color][/color]


      Comment

      • Bob Lehmann

        #4
        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

        "mallyonlin e" <malcolmkwhyte@ btinternet.com> wrote in message
        news:dihai0$pl0 $1@nwrdmz01.dmz .ncs.ea.ibs-infra.bt.com...[color=blue]
        > Thank you for showing your interest.
        >
        > Keeping in mind that i have made changes to allow for the page to be[/color]
        browsed[color=blue]
        > by directory from the server.(IIS6)
        >
        > The Code:
        > <%
        > Dim objFSO,objFldr, objFl, sPath
        > sPath = "Local Drive:\Inetpub\ wwwroot\folder contents"
        > Set objFSO=Server.C reateObject("Sc ripting.FileSys temObject")
        > 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 &[/color]
        "</a><br[color=blue]
        > />"
        > Next
        > Set objFldr=Nothing
        > Set objFSO=Nothing
        > %>
        >
        >
        > "Curt_C [MVP]" <software_at_da rkfalz.com> wrote in message
        > news:D8B5B576-6433-4353-9830-B15CC6AACDBC@mi crosoft.com...[color=green]
        > > Sadly, you'll have to show the code, but really only the lines that[/color][/color]
        write[color=blue][color=green]
        > > 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
        > >
        > >
        > >
        > > "mallyonlin e" wrote:
        > >[color=darkred]
        > >> 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[/color][/color][/color]
        and[color=blue][color=green][color=darkred]
        > >> 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[/color][/color][/color]
        media[color=blue][color=green][color=darkred]
        > >> 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
        > >> user.response@b tconnect.com
        > >>
        > >>
        > >>
        > >> If you could help on this I would be much appreciative.
        > >>
        > >> Kind Regards
        > >>
        > >> Malcolm
        > >>
        > >>
        > >>[/color][/color]
        >
        >[/color]


        Comment

        Working...