% '☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆ '★ ★ '☆ eWebEditor - eWebSoft在线编辑器 ☆ '★ ★ '☆ 版权所有: eWebSoft.com ☆ '★ ★ '☆ 程序制作: eWeb开发团队 ☆ '★ email:webmaster@webasp.net ★ '☆ QQ:589808 ☆ '★ ★ '☆ 相关网址: [产品介绍]http://www.eWebSoft.com/Product/eWebEditor/ ☆ '★ [支持论坛]http://bbs.eWebSoft.com/ ★ '☆ ☆ '★ 主页地址: http://www.eWebSoft.com/ eWebSoft团队及产品 ★ '☆ http://www.webasp.net/ WEB技术及应用资源网站 ☆ '★ http://bbs.webasp.net/ WEB技术交流论坛 ★ '★ ★ '☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆ %> <% Dim sStyleID, sUploadDir, sCurrDir, sDir sPosition = sPosition & "上传文件管理" Call Header() Call Content() Call Footer() Sub Content() If IsObjInstalled("Scripting.FileSystemObject") = False Then Response.Write "此功能要求服务器支持文件系统对象(FSO),而你当前的服务器不支持!" Exit Sub End If ' 初始化传入参数 Call InitParam() Select Case sAction Case "DELALL" ' 删除所有文件 Call DoDelAll() Case "DEL" ' 删除指定文件 Call DoDel() Case "DELFOLDER" ' 删除文件夹 Call DoDelFolder() End Select ' 显示文件列表 Call ShowList() End Sub ' UploadFile目录下的所有文件列表 Sub ShowList() Response.Write "
" & _ "
" If sCurrDir = "" Then Exit Sub Response.Write "

| " If nCurrPage > 1 Then Response.Write "首页 上一页 " Else Response.Write "首页 上一页 " End If If nCurrPage < i / nPageSize Then Response.Write "下一页 尾页" Else Response.Write "下一页 尾页" End If Response.Write " 共" & nFileNum & "个 页次:" & nCurrPage & "/" & nPageNum & " " & nPageSize & "个文件/页" Response.Write " |
" End Sub ' 删除指定的文件 Sub DoDel() On Error Resume Next Dim sFileName, oFSO, sMapFileName Set oFSO = Server.CreateObject("Scripting.FileSystemObject") For Each sFileName In Request.Form("delfilename") sMapFileName = Server.MapPath(sCurrDir & sFileName) If oFSO.FileExists(sMapFileName) Then oFSO.DeleteFile(sMapFileName) End If Next Set oFSO = Nothing End Sub ' 删除所有的文件 Sub DoDelAll() On Error Resume Next Dim sFileName, oFSO, sMapFileName, oFolder, oFiles, oFile Set oFSO = Server.CreateObject("Scripting.FileSystemObject") Set oFolder = oFSO.GetFolder(Server.MapPath(sCurrDir)) Set oFiles = oFolder.Files For Each oFile In oFiles sFileName = oFile.Name sMapFileName = Server.MapPath(sCurrDir & sFileName) If oFSO.FileExists(sMapFileName) Then oFSO.DeleteFile(sMapFileName) End If Next Set oFile = Nothing Set oFolder = Nothing Set oFSO = Nothing End Sub ' 删除文件夹 Sub DoDelFolder() On Error Resume Next Dim sFolderName, oFSO, sMapFolderName Set oFSO = Server.CreateObject("Scripting.FileSystemObject") sFolderName = Trim(Request("foldername")) sMapFolderName = Server.Mappath(sCurrDir & sFolderName) If oFSO.FolderExists(sMapFolderName) = True Then oFSO.DeleteFolder(sMapFolderName) End If Set oFSO = Nothing End Sub ' 检测服务器是否支持某一对象 Function IsObjInstalled(strClassString) On Error Resume Next IsObjInstalled = False Err = 0 Dim xTestObj Set xTestObj = Server.CreateObject(strClassString) If 0 = Err Then IsObjInstalled = True Set xTestObj = Nothing Err = 0 End Function ' 按文件名取图 Function FileName2Pic(sFileName) Dim sExt, sPicName sExt = UCase(Mid(sFileName, InstrRev(sFileName, ".")+1)) Select Case sExt Case "TXT" sPicName = "txt.gif" Case "CHM", "HLP" sPicName = "hlp.gif" Case "DOC" sPicName = "doc.gif" Case "PDF" sPicName = "pdf.gif" Case "MDB" sPicName = "mdb.gif" Case "GIF" sPicName = "gif.gif" Case "JPG" sPicName = "jpg.gif" Case "BMP" sPicName = "bmp.gif" Case "PNG" sPicName = "pic.gif" Case "ASP", "JSP", "JS", "PHP", "PHP3", "ASPX" sPicName = "code.gif" Case "HTM", "HTML", "SHTML" sPicName = "htm.gif" Case "ZIP" sPicName = "zip.gif" Case "RAR" sPicName = "rar.gif" Case "EXE" sPicName = "exe.gif" Case "AVI" sPicName = "avi.gif" Case "MPG", "MPEG", "ASF" sPicName = "mp.gif" Case "RA", "RM" sPicName = "rm.gif" Case "MP3" sPicName = "mp3.gif" Case "MID", "MIDI" sPicName = "mid.gif" Case "WAV" sPicName = "audio.gif" Case "XLS" sPicName = "xls.gif" Case "PPT", "PPS" sPicName = "ppt.gif" Case "SWF" sPicName = "swf.gif" Case Else sPicName = "unknow.gif" End Select FileName2Pic = "