www.gusucode.com > 星云DJ舞曲 4.5a源码程序 > admin/admin_fm_Up.asp
<!--#include FILE="admin_fm_upload.inc"--> <!--#include FILE="admin_fm_sub.asp"--> <!--#include file="const.asp"--> <%CheckAdmin1%> <% '在文件重命名时,如果用户没有输入新文件扩展名,是否允许自动补上原来的扩展名。 'true 为允许,false 为不允许。 '----------------------------------------------------------------------------------- Const AutoAddExt = true Dim ServName,NowFolder,VNowFolder,v_path_s,cookies_path,Vpath Dim EnterFolder,UpFolder Dim upload,file,formName,formPath,iCount,filename,fileExt Dim NumFolder,NumFile,TotalSize Dim fsize '文件及文件夹大小 '获取初始目录 '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v_path_s = split( Request.ServerVariables("PATH_INFO") , "/" ) VpathArrLast = ubound( v_path_s ) cookies_path = "/" for i=1 to VpathArrLast-1 cookies_path = cookies_path & v_path_s(i) & "/" next '获取当前目录,VNowFolder 是虚拟目录 '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Response.Cookies("xing").Expires=Now()+1000 VNowFolder = request.cookies("xing")("VFolderPath") if VNowFolder = "" then VNowFolder = cookies_path Set objFSO = Server.CreateObject("Scripting.FileSystemObject") '检查目录是否存在 '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub CheckFolder( Folder,is_not,AlertInfo ) 'is_not 是布尔值 if objFSO.FolderExists( Folder )=is_not then Response.write("<script>alert('"&AlertInfo&"');this.location='?UpFolder=&EnterFolder=';</script>") end if end sub '检查文件是否存在 '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub CheckFile( File,is_not,AlertInfo ) if objFSO.FileExists(File)=is_not then Response.write("<script>alert('"&AlertInfo&"');this.location='?UpFolder=&EnterFolder=';</script>") end if end sub '处理当前目录,向上 和 进入某目录 '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if Right(VNowFolder,1)<>"/" then VNowFolder=VNowFolder&"/" While inStr(VNowFolder,"//")<>0 VNowFolder = Replace( VNowFolder ,"//","/" ) Wend EnterFolder = Request.QueryString("EnterFolder") if EnterFolder <> "" then ifExistFolder = Server.MapPath( VNowFolder & EnterFolder & "/" ) call CheckFolder( ifExistFolder,false,"路径不存在!" ) VNowFolder = VNowFolder & EnterFolder & "/" end if UpFolder = Request.QueryString("UpFolder") if UpFolder <> "" then if VNowFolder = "/" then Response.write("<script>alert('当前为最高层目录,无法向上!');this.location='?UpFolder=&EnterFolder=';</script>") end if UpFolder = CStr(UpFolder) if Len(VNowFolder)-Len(UpFolder)>0 then VNowFolder = Left( VNowFolder,Len(VNowFolder)-Len(UpFolder)-1 ) end if end if '保存当前目录到 Cookies,NowFolder 为服务器物理目录 '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Response.Cookies("xing")("VFolderPath") = VNowFolder NowFolder = Server.MapPath( VNowFolder ) if Right(NowFolder,1)<>"\" then NowFolder=NowFolder & "\" '处理重命名、新建、删除等操作 '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if request("NewFolderName")<>"" and request("OldFolderName")<>"" then '文件夹重命名 call CheckFileName( request("NewFolderName") ) '检查文件名是否合法 source = NowFolder & request("OldFolderName") destination = NowFolder & request("NewFolderName") call CheckFolder(destination,True,"您要重命名的新文件夹已经存在!") objFSO.MoveFolder source , destination end if if request("NewFileName")<>"" and request("OldFileName")<>"" then '文件重命名 call CheckFileName( request("NewFileName") ) '检查文件名是否合法 source = NowFolder & request("OldFileName") destination = NowFolder & request("NewFileName") call CheckFile(destination,True,"您要重命名的新文件已经存在!") '如果输入的新文件(目标文件)无扩展名,则加上源文件的扩展名 if inStr( request("NewFileName") , "." )=0 and AutoAddExt=True then ArrNewFileName = split( request("OldFileName") , "." ) Ext = ArrNewFileName( ubound(ArrNewFileName) ) destination = destination & "." & Ext end if objFSO.MoveFile source , destination end if if request("DelFolder")<>"" then '删除文件夹 DelFolder = NowFolder & request("DelFolder") call CheckFolder(DelFolder,false,"您要删除的文件夹不存在!") objFSO.DeleteFolder( DelFolder ) end if if request("DelFile")<>"" then '删除文件 DelFile = NowFolder & request("DelFile") call CheckFile( DelFile,false,"没有找到您要删除的文件!") objFSO.DeleteFile( DelFile ) end if if request("CreateFolder")<>"" then '新建文件夹 call CheckFileName( request("CreateFolder") ) '检查文件名是否合法 CreateFolderName = NowFolder & request("CreateFolder") call CheckFolder(CreateFolderName,True,"您要创建的新文件夹已经存在!") objFSO.CreateFolder(CreateFolderName) end if '主操纵台 '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if Request.QueryString("action")="up" then call up() '文件上传 call interface() '打印界面 else call interface() '打印界面 end if %> <table cellPadding=1 cellSpacing=1 width=98%> <tr><td bgcolor=#555555 height=1 width=100% colSpan=6> </td></tr> <tr bgcolor=#0650D2 height=25> <td width=230 align=left colSpan=3><a href="?UpFolder=&EnterFolder="><font color=#ffffff><b>刷新页面</b></font></a> | <b>文件/文件夹名</b></td> <td width=80 align=left><b>大小(Byte)</b></td> <td width=200 align=left> <b>文件类型</b></td> <td width=150 align=left> <b>最后修改时间</b></td> </tr> <% if VNowFolder <> "/" then call GoUpFolder() '当处于非根目录时,打印“向上...”按钮 call ShowFolderList( NowFolder ) '列出当前文件夹中的所有文件夹 call ShowFileList( NowFolder ) '列出当前文件夹中的所有文件 %> </table> <table cellPadding=1 cellSpacing=1 width=98%> <tr> <td height=9 bgcolor=#FFFFFF><b>→</b> <font color=#888888>当前目录共有 <%=NumFile%> 个文件,<%=NumFolder%> 个文件夹,占用空间 <% fsize = TotalSize call Pfsize() response.write(fsize) %>。</td> </tr> <tr><td bgcolor=#0650D2 height=1> </td> <tr> <td align=left> <form action="admin_fm_up.asp" name="CreateNewFolder" method=post> <a href="?UpFolder=&EnterFolder="><font color=#000000><b>刷新页面</b></font></a> | <b>新建文件夹</b> <input type=text name="CreateFolder"> <input type="submit" value="新建" onClick = "return submitchecken();"> <b>使用说明</b>:请单击相应文件图标进行编辑,单击文件名浏览. </b></a> </form> </td> </tr> </table> </body> </html>