日期:2014-05-17  浏览次数:20899 次

高分求:思想方法,最好有例子!

不想通过数据库实现以下功能,因所有文件将通过FTP直接上传。  


A:对根目录所有文件夹进行列表,而且可以进行分页。

B:能读取子目录所有文件名字,并进行分页,点击进行下载。

C:能实现大类,小类,搜索。

如大类:为根目录名称,子目录名称。最后可以搜索文件名。


------解决方案--------------------
下载的话自己另外写个http头
用fso实现遍历的代码 希望对你有用

<%@ LANGUAGE = VBScript %>
<%Server.ScriptTimeout=5000%>

<HTML>
<HEAD>
<TITLE> Files </TITLE>
<link rel= "stylesheet " type= "text/css " href= "ase.css ">
</HEAD>

<BODY topmargin=0>
<%
thisdir=Request( "sPath ")
If thisdir= " " then
thisdir= ". "
End If
Set fs=Server.CreateObject( "Scripting.FileSystemObject ")
Set fdir=fs.GetFolder(thisdir)

response.write " <table width= '100% ' cellpadding= '2 ' cellspacing= '2 '> "
response.write " <tr> <td> &nbsp; </td> <td bgcolor= '#cccccc '> 名称 </td> <td bgcolor= '#cccccc '> 大小 </td> <td bgcolor= '#cccccc '> 类型 </td> <td bgcolor= '#cccccc '> 修改时间 </td> </tr> "
'Response.Write "目录列表: <br> "
For each thing in fdir.SubFolders
Response.Write " <tr> <td> &nbsp; </td> <td colspan= '4 '> <img src= 'images/folder.gif '> <a href= 'files.asp?sPath= " & thisdir & "\ " & thing.Name & " '> " & thing.Name & " </a> </td> </tr> "
Next

'Response.Write "文件列表: <br> "
dim strExt
For each thing in fdir.Files
response.write " <tr> <td> "
'checkbox for select
Response.Write " <input type= 'CheckBox ' name= ' "&thing.name& " '> </td> "
'file name

strExt=lcase(right(thing.Name,4))
select case strExt
case ".htm "
Response.Write " <td> <img src= 'images/html.gif '> " & thing.Name & " <a href= 'edit.asp?filename= "&thisdir& "/ "&thing.name& "&task=read '> <img src= 'images/edit.gif ' width=16 height=16 border=0 alt= '编辑 '> </a> </td> "

case "html "
Response.Write " <td> <img src= 'images/html.gif '> " & thing.Name & " <a href= 'edit.asp?filename= "&thisdir& "/ "&thing.name& "&task=read '> <img src= 'images/edit.gif ' width=16 height=16 border=0 alt= '编辑 '> </a> </td> "
case ".asp "
Response.Write " <td> <img src= 'images/asp.gif '> " & thing.Name & " <a href= 'edit.asp?filename= "&thisdir& "/ "&thing.name& "&task=read '> <img src= 'images/edit.gif ' width=16 height=16 border=0 alt= '编辑 '> </a> </td> "
case ".cgi "
Response.Write " <td> <img src= 'images/perl.gif '> " & thing.Name & " <a href= 'edit.asp?filename= "&thisdir& "/ "&thing.name& "&task=read '> <img src= 'images/edit.gif ' width=16 height=16 border=0 alt= '编辑 '> </a> <