www.gusucode.com > 25175 学生成绩管理查询系统码程序 > ADMIN/fsoexplorer.asp
<!--#include file="../config.asp"--> <!--#include file="inc.asp"--> <% ntime=server.urlencode(now()) selfname=request.servervariables("script_name") pagesize=13 totalpage=1 Call admin_yz(2) path=cj_SystemFolder&"admin/excel/" ntime=date page=trim(request.querystring("page")) act=trim(request.querystring("act")) if page<>"" and isnumeric(page) then page=fix(page) else page=1 end if if path="/" then goparent="◆已经到根目录了..." else goparent="<a href='"&selfname&"?path="&server.urlencode(left(path,instrrev(path,"/",len(path)-1)))&"&ntime="&ntime&"'>↑回上级目录...</a>" end if parent_url=server.urlencode(parent_url) pathurl=server.urlencode(path) s_folderpath=server.mappath(path) set obj_fso=server.createobject("scripting.filesystemobject") if act="paste" and session("act")="copy" and session("basepath")<>s_folderpath and obj_fso.folderexists(s_folderpath)=true then n_errfile=0 n_errfolder=0 if session("folders")<>"" then a_folders=split(session("folders"),chr(9)) m=ubound(a_folders) for i=0 to m s_sourcefolder=session("basepath")&"\"&a_folders(i) s_targetfolder=s_folderpath&"\"&a_folders(i) if obj_fso.folderexists(s_sourcefolder) then obj_fso.copyfolder s_sourcefolder,s_targetfolder,true else n_errfolder=n_errfolder+1 end if next else m=0-1 end if if session("files")<>"" then a_files=split(session("files"),chr(9)) n=ubound(a_files) for i=0 to n s_sourcefile=session("basepath")&"\"&a_files(i) s_targetfile=s_folderpath&"\"&a_files(i) if obj_fso.fileexists(s_sourcefile) then obj_fso.copyfile s_sourcefile,s_targetfile,true else n_errfile=n_errfile+1 end if next else n=0-1 end if elseif act="paste" and session("act")="cut" and session("basepath")<>s_folderpath and obj_fso.folderexists(s_folderpath)=true then n_errfile=0 n_errfolder=0 if session("folders")<>"" then a_folders=split(session("folders"),chr(9)) m=ubound(a_folders) for i=0 to m s_sourcefolder=session("basepath")&"\"&a_folders(i) s_targetfolder=s_folderpath&"\"&a_folders(i) if obj_fso.folderexists(s_sourcefolder) then obj_fso.copyfolder s_sourcefolder,s_targetfolder,true obj_fso.deletefolder s_sourcefolder,true else n_errfolder=n_errfolder+1 end if next end if if session("files")<>"" then a_files=split(session("files"),chr(9)) n=ubound(a_files) for i=0 to n s_sourcefile=session("basepath")&"\"&a_files(i) s_targetfile=s_folderpath&"\"&a_files(i) if obj_fso.fileexists(s_sourcefile) then obj_fso.copyfile s_sourcefile,s_targetfile,true obj_fso.deletefile s_sourcefile,true else n_errfile=n_errfile+1 end if next end if session("act")="" session("basepath")="" session("folders")="" session("files")="" end if %> <html> <head> <title><%=sysname%>--文件管理</title> <meta http-equiv="Content-Type" content="text/html;charset=gb2312"> <meta name="author" content="netasp;EMAIL:huyinglong@msn.com"> <style type="text/css"> <!-- @import url("Admin_Style.css"); --> </style> <script language="javascript"> <!-- function viewfile(path) { window.open(path,'',''); } function delfile(act,fname) { fname=urlencoding(fname); if (window.confirm("你真的要删除该文件吗?")==true) { window.location.href="fsodel.asp?act="+act+"&path=<%=pathurl%>"+fname+"&epath=<%=pathurl%>&epage=<%=page%>&ntime=<%=ntime%>"; } } //--> </script> <script language="vbscript"> <!-- function urlencoding(vstrin) dim i,strreturn,strSpecial strSpecial = "!""#$%&'()*+,/:;<=>?@[\]^`{|}~%" strreturn = "" for i = 1 to len(vstrin) thischr = mid(vstrin,i,1) if abs(asc(thischr)) < &hff then if thischr=" " then strreturn = strreturn & "+" elseif instr(strSpecial,thischr)>0 then strreturn = strreturn & "%" & hex(asc(thischr)) else strreturn = strreturn & thischr end if else innercode = asc(thischr) if innercode < 0 then innercode = innercode + &h10000 end if hight8 = (innercode and &hff00)\ &hff low8 = innercode and &hff strreturn = strreturn & "%" & hex(hight8) & "%" & hex(low8) end if next urlencoding = strreturn end function //--> </script> <head> <body> <table width="98%" align="center" border='0' align='center' cellpadding='0' cellspacing='0' class='border'> <%if obj_fso.folderexists(s_folderpath) then set obj_folder=obj_fso.getfolder(s_folderpath) if obj_folder.files.count mod pagesize=0 then totalpage=obj_folder.files.count\pagesize else totalpage=obj_folder.files.count\pagesize+1 end if if page<1 then page=1 end if if page>totalpage then page=totalpage end if %><tr class='title'> <td align="center" colspan="6"> <b>EXCEL文件列表</b> </td> </tr> <% i=1 ii=0 startnum=(page-1)*pagesize for each s_file in obj_folder.files file_type=getname(s_file,".") if i>startnum And file_type="xls" Then If ii = 0 Then response.write "<tr class='tdbg' onmouseout=""this.style.backgroundColor=''"" onmouseover=""this.style.backgroundColor='#BFDFFF'"">"&vbcrlf response.write "<td width='20'></td><td width='200'>"&vbcrlf %> <a href="#" onclick="javascript:parent.document.forms[0].ExName.value='<%=s_file.name%>';" title="文件大小:<%=GetFileSize(s_file.size)%> 上传时间:<%=s_file.datelastmodified%>"><%=s_file.name%></a> </td> <% response.write "<td width='30'>" response.write "<a href=""javascript:delfile('delfile','"&s_file.name&"')"">删除</a></td>"&vbcrlf end if if i>startnum+pagesize then exit for end if i=i+1 ii=ii+1 If ii=2 Then response.write "</tr>" ii=0 End If Next If ii=0 Then response.write "<td></td><td></td><td></td>"&vbcrlf response.write "</tr>" End If %> <tr> <td colspan=6 align=center><% response.write "共"&obj_folder.files.count&"个文件 当前第 " response.write "<select name='jtp' style='line-height:12px;border:none;height:12px;padding:0' onchange="&chr(34)&"window.location.href='"&selfname&"?page='+(this.options.selectedIndex+1)+'&path="&pathurl&"&ntime="&ntime&"'"&chr(34)&">"&vbcrlf for i=1 to totalpage if i=page then response.write "<option selected>"&i&vbcrlf else response.write "<option>"&i&vbcrlf end if next response.write "</select>"&vbcrlf response.write " 页"&vbcrlf response.write " 共 "&totalpage&" 页" if page>1 then response.write " <a href='"&selfname&"?path="&pathurl&"&page="&(page-1)&"&ntime="&ntime&"'>上一页</a>" Else response.write " 上一页" end if if page<totalpage then response.write " <a href='"&selfname&"?path="&pathurl&"&page="&(page+1)&"&ntime="&ntime&"'>下一页</a> " Else response.write " 下一页 " end if response.write "</td>"&vbcrlf&"</tr>"&vbcrlf response.write "</form>"&vbcrlf&"</table>"&vbcrlf set obj_folder=nothing else response.write "<div style='width:100%;padding:25px 0 15px;text-align:center;background:transparent;color:#ff3333;font-weight:600'>文件夹不存在或者你没有访问权限</div>" end if set obj_fso=nothing %> </body> </html>