|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
由于ASP提供的是一对多的服务,所以用户的一些特殊需求很难得到满足。**************************************
Name:File/DirectoryViewer
Description:ThisWillDisplayAllThe
Files,FileSizeandfiledateofevery
fileinthedirectoryyouspecify.
Tomakethiswork,pastethecodeintoyourfavoritehtmleditor,saveitandThenviewit.
By:ThomasMichael
Inputs:None
Returns:None
Assumes:FileSystemObjectBeNeeded:)
anditissetuptolookforyoumydocum
entsfolderat"c:mydocu~1"butyoucan
changethelineofcodetolookinanyd
irectory.
SideEffects:None
Warranty:
codeprovidedbyPlanetSourceCode(tm)
(http://www.Planet-Source-Code.com)as
is,withoutwarrantiesastoperformanc
e,fitness,merchantability,andanyothe
rwarranty(whetherexpressedorimplied
).
TermsofAgreement:
Byusingthissourcecode,youagreeto
thefollowingterms...
1)Youmayusethissourcecodeinper
sonalprojectsandmaycompileitintoa
n.exe/.dll/.ocxanddistributeitinbi
naryformatfreelyandwithnocharge.
2)YouMAYNOTredistributethissourc
ecode(forexampletoawebsite)witho
utwrittenpermissionfromtheoriginal
author.Failuretodosoisaviolationo
fcopyrightlaws.
3)Youmaylinktothiscodefromanot
herwebsite,provideditisnotwrapped
inaframe.
4)Theauthorofthiscodemayhavere
tainedcertainadditionalcopyrightrigh
ts.Ifso,thisisindicatedintheautho
rsdescription.
**************************************
<%@LANGUAGE="VBSCRIPT"%>
<%OptionExplicit%>
<HTML>
<HEAD><TITLE>FileViewer</TITLE></HEAD>
<BODY>
<TABLEwidth="100%"border=1bordercolor="#000000"align="left"cellpadding="2"cellspacing="0">
<TRalign="left"valign="top"bgcolor="#000000">
<TDwidth="65%"><FONTcolor="#FFFFFF"><B><FONTsize="2"face="Verdana,Arial,Helvetica,sans-
serif">Title</FONT></B></FONT></TD>
<TDwidth="10%"><FONTcolor="#FFFFFF"><B><FONTsize="2"face="Verdana,Arial,Helvetica,sans-
serif">Size</FONT></B></FONT></TD>
<TDwidth="25%"><FONTcolor="#FFFFFF"><B><FONTsize="2"face="Verdana,Arial,Helvetica,sans-
serif">Date</FONT></B></FONT></TD>
</TR>
<%
FileSystemObject
DimobjFSO
FileObject
DimobjFile
FolderObject
DimobjFolder
StringToStoreTheRealPath
DimsMapPath
CreateFileSystemObjectToGetlistoffiles
SetobjFSO=CreateObject("Scripting.FileSystemObject")
GetThepathForthewebpageanditsdir.
changethissettingToviewdifferentdirectories
sMapPath="C:Mydocu~1"
SettheobjectfolderTothemappedpath
SetobjFolder=objFSO.GetFolder(sMapPath)
ForEachfileInthefolder
ForEachobjFileInobjFolder.Files
%>
<TRalign="left"valign="top"bordercolor="#999999"bgcolor="#FFFFFF">
<TD><FONTsize="2"face="Verdana,Arial,Helvetica,sans-serif"color="#000000"><Ahref="<%=
sMapPath&"/"&objFile.Name%>">
<%
writethefilesname
Response.WriteobjFile.Name
%>
</A>
</FONT>
</TD>
<TD>
<FONTsize="2"face="Verdana,Arial,Helvetica,sans-serif"color="#000000">
<%
Wewillformatthefilesizesoitlookspretty
IfobjFile.Size<1024Then
Response.WriteobjFile.Size&"Bytes"
ElseIfobjFile.Size<1048576Then
Response.WriteRound(objFile.Size/1024.1)&"KB"
Else
Response.WriteRound((objFile.Size/1024)/1024.1)&"MB"
EndIf
%>
</FONT>
</TD>
<TD>
<FONTsize="2"face="Verdana,Arial,Helvetica,sans-serif"color="#000000">
<%thefilesDate
Response.WriteobjFile.DateLastModified
%>
</FONT>
</TD>
</FONT>
</TD>
</TR>
<%
Next
%>
</TABLE>
</BODY>
</HTML>
asp可以轻松地实现对页面内容的动态控制,根据不同的浏览者,显示不同的页面内容。而浏览者一点觉察不出来,就像为他专门制作的页面一样。使用各种各样的组件,asp可以完成无比强大的功能。 |
|