首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

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

2012-03-22 
高分求:思想方法,最好有例子! 不想通过数据库实现以下功能,因所有文件将通过FTP直接上传。A:对根目录所有文

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

不想通过数据库实现以下功能,因所有文件将通过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> </td> "

case ".txt "
Response.Write " <td> <img src= 'images/txt.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 ".gif "
Response.Write " <td> <img src= 'images/gif.gif '> " & thing.Name & " </td> "
case ".jpg "
Response.Write " <td> <img src= 'images/jpg.gif '> " & thing.Name & " </td> "
case ".zip "
Response.Write " <td> <img src= 'images/zip.gif '> " & thing.Name & " </td> "
case ".exe "
Response.Write " <td> <img src= 'images/exe.gif '> " & thing.Name & " <a href= 'fileop.asp?filename= "&thisdir& "/ "&thing.name& "&action=execute '> <img src= 'images/execute.gif ' width=16 height=16 border=0 alt= '执行 '> </a> </td> "
case else
if right(thing.name,3)= ".pl " then
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> "
else
Response.Write " <td> <img src= 'images/unknown.gif '> " & thing.Name & " </td> "
end if
end select
'file properties
response.write " <td> " & cstr(thing.size) & " </td> <td> " & thing.type & " </td> <td> " & cstr(thing.datelastmodified) & " </td> </tr> "
Next


response.write " </table> "
%>

</BODY>
</HTML>

热点排行