navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

using file system object to view directory

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> using file system object to view directory
Page: [1]
 
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>


(in reply to Rizzo)
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!


(in reply to Rizzo)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> using file system object to view directory
Page: [1]
Jump to: 1





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