
Please Click Here if you do not see a menu frame on the left
<%
' This function takes a filename and returns the appropriate image for
' that file type based on it's extension. If you pass it "dir", it assumes
' that the corresponding item is a directory and shows the folder icon.
Function ShowImageForType(strName)
Dim strTemp
' Set our working string to the one passed in
strTemp = strName
' If it's not a directory, get the extension and set it to strTemp
' If it is a directory, then we already have the correct value
If strTemp <> "dir" Then
strTemp = LCase(Right(strTemp, Len(strTemp) - InStrRev(strTemp, ".", -1, 1)))
End If
' Debugging line used to perfect that above string parser
'Response.Write strTemp
' Set the part of the image file name that's unique to the type of file
' to it's correct value and set this to strTemp. (yet another use of it!)
Select Case strTemp
Case "dir"
strTemp = "dir"
Case "gif", "jpg"
strTemp = "img"
Case Else
strTemp = "txt"
End Select
' All our logic is done... build the IMG Tag for display to the browser
' Place it into... where else... strTemp!
' My images are all GIFs and all start with "dir_" for my own sanity.
' They end with one of the values set in the select statement above.
strTemp = ""
' Set return value and exit function
ShowImageForType = strTemp
End Function
'That's it for functions on this one!
%>
<%' Now to the Runtime code:
Dim strPath 'Path of directory to show
Dim objFSO 'FileSystemObject variable
Dim objFolder 'Folder variable
Dim objItem 'Variable used to loop through the contents of the folder
Dim scriptLoc 'The actual location of this script. If you need to copy this into another folder, this var will need to be changed in order for it to work there. I needed this for subdirectories.
scriptLoc = "/bigdaddyebay"
' You could just as easily read this from some sort of input, but I don't
' need you guys and gals roaming around our server so I've hard coded it to
' a directory I set up to illustrate the sample.
' NOTE: As currently implemented, this needs to end with the /
strPath = "./"
currentDir = ""
if request.querystring("dir") <> "" then
strPath = "./" & request.querystring("dir")
currentDir = request.querystring("dir") & "/"
end if
' Create our FSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
' Get a handle on our folder
Set objFolder = objFSO.GetFolder(Server.MapPath(strPath))
' Show a little description line and the title row of our table
%>
<%= currentDir %>
| File Name: | File Size (bytes): | Date Created: | File Type: |
| <%= ShowImageForType("dir") %> "><%= objItem.Name %> | <%= objItem.Size %> | <%= objItem.DateCreated %> | <%= objItem.Type %> |
| <%= ShowImageForType(objItem.Name) %> <%= objItem.Name %> | <%= objItem.Size %> | <%= objItem.DateCreated %> | <%= objItem.Type %> |
[Home]
Big Daddy title, background art work, and Bally logo are
copyright by Williams Electronics Co.
Gottlieb logos are copyright by D. Gottlieb & Company All other content
is copyright by Big Daddy Enterprises 2005 and may not be borrowed, copied,
downloaded, or reproduced in any way whatsoever without prior written consent
from Big Daddy Enterprises