当前位置: 首页 > 图文教程 > 网络编程 > ASP > vithink小文件自动实现文件浏览下载

ASP
[原创]asp截取字符串的两种应用
内容分页函数
一搜图片搜索小偷
Web代理(Asp版)
实例分析ASP上传漏洞入侵实战及扩展
asp如何用discuz会员系统
asp javascript在线管理
newasp中main类
文章列表类别
[ASP]精华代码
登陆asp class
信息采集程序
用XML+FSO+JS实现服务器端文件的
vithink小文件自动实现文件浏览下载
使用FSO按文件大小浏览文件目录并进行删除操作
列出指定目录下的所有文件和目录
日期函数扩展类Ver0.1.1
管理员登录
cls_main.asp
asp提高首页性能的一个技巧

ASP 中的 vithink小文件自动实现文件浏览下载


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-12   浏览: 25 ::
收藏到网摘: n/a

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
 <script src=http://www.mithink.com/js/top.js></script>
<table id="table16" cellSpacing="0" cellPadding="0" width="765" border="0">
<tr>
<td vAlign="bottom" align="middle" colSpan="2">
<table id="table21" cellSpacing="0" cellPadding="0" width="765" align="center" border="0">
<tr>
<td ><%
Set FSO = CreateObject("Scripting.FileSystemObject")
hu = Replace(Server.MapPath("index.asp"),"index.asp","") '本系统所在目录

Set TestFolder = FSO.GetFolder(hu)
GenerateTestInformation = GenerateAllFolderInformation(TestFolder)
Function GenerateAllFolderInformation(Folder)
Dim S, SubFolders, SubFolder, Files, File, i
tmpStr = ""
Set SubFolders = Folder.SubFolders

If SubFolders.Count <> 0 Then
i = 1
For Each SubFolder In SubFolders
i = i + 1
tmpStr = tmpStr & GenerateFolderInformation(SubFolder,i)
Next
End If
Response.Write tmpStr & "</table><br>"
tmpStr = ""
Set Files = Folder.Files
tmpStr = tmpStr & "<table border=0 width=100% cellspacing=1 cellpadding=4 align='left' style='word-break: break-all'>"
tmpStr = tmpStr & ""
If Not (Folder.IsRootFolder) Then
tmpStr = tmpStr & ""
End If
tmpStr = tmpStr & ""
tmpStr = tmpStr & ""

If Files.Count <> 0 Then
i = 1
For Each File In Files
i = i + 1
tmpStr = tmpStr & GenerateFileInformation(File,i)
Next
End If
Response.Write tmpStr & "</table>"
End Function

Function UrlEnCode(Path)
UrlEnCode = Replace(Server.URLEncode(Path),"\","/")
End Function
Function CloseFSO
FSO.Close
Set FSO = Nothing
End Function

Function GenerateFileInformation(File,i)
Dim S, RowColor
RowColor = ""
If i Mod 2 = 0 Then RowColor = "bgcolor=#9999dd"
If i Mod 2 <> 0 Then RowColor = "bgcolor=#aaaaee"

S = "<tr><td "&RowColor&" > " & File.Name & "</td>"
S = S & "<td "&RowColor&">" & FormatNumber(File.Size/1024 ,0) & " KB</td>"
S = S & "<td align=center "&RowColor&">"
S = S & "<a href='" & File.Name & "' > ↓</a></td></tr>"
GenerateFileInformation = S
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' 函数名称:GenerateFolderInformation()
' 功能说明:描述文件夹的当前状态
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function GenerateFolderInformation(Folder,i)
Dim S, RowColor
RowColor = ""
If i Mod 2 = 0 Then RowColor = "bgcolor=#dddddd"

S = ""

GenerateFolderInformation = S
End Function
%>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script src=http://www.mithink.com/js/bottom1.js></script>
</body>
</html>