%@LANGUAGE="VBSCRIPT"%> <% Option Explicit On Error Resume Next ' this section is optional - it just denies anonymous access 'If Request.ServerVariables("LOGON_USER")="" Then ' Response.Status = "401 Access Denied" 'End If ' declare variables Dim objFSO, objFolder Dim objCollection, objItem Dim strPhysicalPath, strTitle, strServerName Dim strPath, strTemp Dim strName, strFile, strExt, strAttr Dim intSizeB, intSizeK, intAttr, dtmDate ' declare constants Const vbReadOnly = 1 Const vbHidden = 2 Const vbSystem = 4 Const vbVolume = 8 Const vbDirectory = 16 Const vbArchive = 32 Const vbAlias = 64 Const vbCompressed = 128 ' don't cache the page Response.AddHeader "Pragma", "No-Cache" Response.CacheControl = "Private" ' get the current folder URL path strTemp = Mid(Request.ServerVariables("URL"),2) strPath = "" Do While Instr(strTemp,"/") strPath = strPath & Left(strTemp,Instr(strTemp,"/")) strTemp = Mid(strTemp,Instr(strTemp,"/")+1) Loop strPath = "/" & strPath ' build the page title strServerName = UCase(Request.ServerVariables("SERVER_NAME")) strTitle = "Contents of the " & strPath & " folder" ' create the file system objects strPhysicalPath = Server.MapPath(strPath) Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(strPhysicalPath) %>
| Name | Bytes | KB | Attributes | Ext | Type | Date | Time |
|---|---|---|---|---|---|---|---|
| <%=strName%> | N/A | N/A | <%=strAttr%> | Directory | <%=FormatDateTime(dtmDate,vbShortDate)%> | <%=FormatDateTime(dtmDate,vbLongTime)%> | |
| <%=strFile%> | <%=FormatNumber(intSizeB,0)%> | <%=intSizeK%>K | <%=strAttr%> | <%=strExt%> | <%=objItem.Type%> | <%=FormatDateTime(dtmDate,vbShortDate)%> | <%=FormatDateTime(dtmDate,vbLongTime)%> |