469,602 Members | 1,826 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

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
us***********@btconnect.com

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

Kind Regards

Malcolm
Oct 11 '05 #1
3 2683
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
us***********@btconnect.com

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

Kind Regards

Malcolm

Oct 11 '05 #2
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.FileSystemOb ject")
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:D8**********************************@microsof t.com...
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
us***********@btconnect.com

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

Kind Regards

Malcolm

Oct 11 '05 #3
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" <ma***********@btinternet.com> wrote in message
news:di**********@nwrdmz01.dmz.ncs.ea.ibs-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.FileSystemOb ject")
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:D8**********************************@microsof t.com...
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
us***********@btconnect.com

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

Kind Regards

Malcolm


Oct 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by New User | last post: by
1 post views Thread by Jim in Arizona | last post: by
2 posts views Thread by ats | last post: by
reply views Thread by =?Utf-8?B?ZGIgY2hhbGxlbmdlZA==?= | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.