stevemarsh99
Technical User
Guys, this code below displays the contents of a directly in plain text with <br> in a list:
<%
folder = "C:\Downloads"
set fso = CreateObject("Scripting.fileSystemObject")
set fold = fso.getFolder(folder)
fileCount = fold.files.count
dim fNames()
redim fNames(fileCount)
cFcount = 0
for each file in fold.files
cFcount = cFcount + 1
fNames(cFcount) = lcase(file.name)
next
for tName = 1 to fileCount
for nName = (tName + 1) to fileCount
if strComp(fNames(tName),fNames(nName),0)=1 then
buffer = fNames(nName)
fNames(nName) = fNames(tName)
fNames(tName) = buffer
end if
next
next
for i = 1 to fileCount
content = content & fNames(i) & "<br>"
next
Response.Write content
%>
How would I get these entries to appear in a list/dropdown menu with the values of the entry being equal to the actual name of the file in the directory?
In simple terms, I have a folder that holds images. I want the dropdown menu to list all the files in the folder on my server so when you select the option, the value is the name of the file.
Thanks
Steve
<%
folder = "C:\Downloads"
set fso = CreateObject("Scripting.fileSystemObject")
set fold = fso.getFolder(folder)
fileCount = fold.files.count
dim fNames()
redim fNames(fileCount)
cFcount = 0
for each file in fold.files
cFcount = cFcount + 1
fNames(cFcount) = lcase(file.name)
next
for tName = 1 to fileCount
for nName = (tName + 1) to fileCount
if strComp(fNames(tName),fNames(nName),0)=1 then
buffer = fNames(nName)
fNames(nName) = fNames(tName)
fNames(tName) = buffer
end if
next
next
for i = 1 to fileCount
content = content & fNames(i) & "<br>"
next
Response.Write content
%>
How would I get these entries to appear in a list/dropdown menu with the values of the entry being equal to the actual name of the file in the directory?
In simple terms, I have a folder that holds images. I want the dropdown menu to list all the files in the folder on my server so when you select the option, the value is the name of the file.
Thanks
Steve