<%@LANGUAGE="VBSCRIPT"%>
<%
	Option Explicit	

	Dim strDocsPath, strDocsPhysicalPath
	Dim objFSO, objFolder, objFiles, objFile
	Dim strName, strFile, strType, lngSize

	' NOTE: set the following line to the folder to display
	strDocsPath = "docs"

	' map the folder to a physical path
	strDocsPhysicalPath = Server.MapPath(strDocsPath)

	' create a system file object
 	Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

	' create an object for the folder
	Set objFolder = objFSO.GetFolder(strDocsPhysicalPath)

%>
<html>
<head>
<title>Table Of Contents</title>
</head>

<body>

<h1 align="center">Table Of Contents</h1>

<h4>Please choose the Document to view.</h4>

<ul>
<%
	' create a files collection
	Set objFiles = objFolder.Files

	' step through the files collection
	For Each objFile in objFiles

		' get a file's name
		strName = objFile.Name

		' make it lowercase for the URL
		strFile = Lcase(strName)

		' get the file's type
		strType = objFile.Type

		' make the name a title for display
		strName = MakeTitle(strName)

		' get the file size in KB
		lngSize = objFile.Size\1024

		' output the filename and URL
		Response.Write "<li><a href=""" & strDocsPath & "/" & strFile & """>" & strName & "</a><br>"

		' output the file's size and type
		Response.Write "<em>(" & lngSize & "KB " & strType & ")</em></li>" & vbCrLf
	Next

	' this function drops the extension from a file
	Function MakeTitle(strTemp)
		If InStrRev(strTemp,".") Then
			strTemp = Left(strTemp,InStrRev(strTemp,".")-1)
		End If
		MakeTitle = strTemp
	End Function
%>
</ul>
</body>
</html>
				

'asp' 카테고리의 다른 글

ASP Examples  (0) 2010.03.31
ASP Response Object  (0) 2010.03.31
ASP에서 웹서비스(WebService) 호출  (0) 2010.03.23
ABC 컴포넌트 다중업로드  (0) 2010.03.19
ASP문법과 함수들  (0) 2010.03.19

+ Recent posts