Using the
File System Object
to
Display Directory Content w/Form Interface
:
Click here to test this script.
Code:
Place in the <BODY>:
Highlight
<%dim fsoimage, fsofiles, fsofolder, Directory Directory = "DIRECTORY NAME/" set fsoimage=server.createobject("Scripting.FileSystemObject") set fsofolder=fsoimage.getfolder(server.MapPath(".") & "/" & (Directory)) set fsofiles=fsofolder.files %>
Files:
<% for each file in fsofiles if right(file.name,NUMBER OF DIGITS COMPRISING FILE EXTENSION)="FILE EXTENSION NAME" then%>
<%=file.name%>
<%end if next%>
<% set fsofolder=nothing set fsoimage=nothing %>
results.asp:
Highlight
File Name: <%=request.form("FileName")%>
>