|
| |
|
|
Rizzo
Posts: 42 Joined: 12/7/2001 From: Status: offline
|
using file system object to view directory - 12/8/2001 9:29:15
I found a nifty script that uses the file system object and lets you see the files in a directory which is a good start for what I need. It was setup by default as showing the file names as text but I want the file names to be options that can be selected so in front page I added the drop down menu to it now it looks like this: <% Set MyDirectory=Server.CreateObject("Scripting.FileSystemObject") Set MyFiles=MyDirectory.GetFolder(Server.MapPath("/teamhs/images")) For each filefound in MyFiles.files %> <select name="choose"> <option><% =filefound.Name %></option> </select> <% Next %> only problem is, each file creates its own drop down menu...that's not what I wanted to do :) look http://www.graphic-group.com/teamhs/dir.asp there should be 2 files in one drop down menu instead of 2 drop down menu's with one file each, anyone have a clue?
|
|
|
|
martinchisholm
Posts: 8 From: None Status: offline
|
RE: using file system object to view directory - 12/8/2001 12:07:04
Hi, I think your code is correct, just slightly in the wrong order. You are looping the creation of the option box as well as the content. I think by simply moving the option box make up outside of the loop will solve your problem, try the below: <% Set MyDirectory=Server.CreateObject("Scripting.FileSystemObject") Set MyFiles=MyDirectory.GetFolder(Server.MapPath("/teamhs/images")) %> <select name="choose"> <% For each filefound in MyFiles.files %> <option><% =filefound.Name %></option> <% Next %> </select>
|
|
|
|
Rizzo
Posts: 42 Joined: 12/7/2001 From: Status: offline
|
RE: using file system object to view directory - 12/8/2001 12:34:20
Hey you saved my day, thanks man it works great thanks again!
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|