...

View Full Version : Using a listall function in a list menu



Matc
07-07-2004, 11:31 AM
Hi there

ive go the following code called list.asp which can display all the files in a certain directory

<%


Set Objekt=Server.CreateObject("Scripting.FileSystemObject")
Set Folder=Objekt.GetFolder(Server.MapPath("pressreleases/"))
FOR EACH sak in Folder.Files
if sak.Name="list.asp" then
'ReadFileLineByLine(Server.MapPath("pressreleases/"))

end if
%>

<%=sak.Name%><br>


<%
NEXT
%>

I want to be able to somehow insert this into a listmenu, so a user can select from the drop down menu, the appropriate file to link to the title they have entered in an add record. Im having problems though, anyone got any ideas?
Thanks

Mat

glenngv
07-07-2004, 12:18 PM
Is this what you needed?


<%
dim optionTag, Objekt, Folder
Set Objekt=Server.CreateObject("Scripting.FileSystemObject")
Set Folder=Objekt.GetFolder(Server.MapPath("pressreleases/"))
For Each sak in Folder.Files
if LCase(sak.Name)<>"list.asp" then
optionTag = optionTag & "<option>" & sak.Name & "</option>" & vbCrLf
end if
Next
%>
<select name="files">
<%=optionTag%>
</select>

Matc
07-07-2004, 12:24 PM
Thats the one, I had just managed to work it so the 1st one in the folder would show up in the list but no others. I was having problems repeating it to show what else was in the folder. That code worked perfectly to sort it.

Thanks very much mate

Mat



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum