<% 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 JoinChar(strUrl) if strUrl="" then JoinChar="" exit function end if if InStr(strUrl,"?")1 then if InStr(strUrl,"&")"" then currentPage=clng(request("page")) else currentPage=1 end if select case DialogType case "pic" strUpFileType=UpFileType_pic case "flash" strUpFileType=UpFileType_flash case "media" strUpFileType=UpFileType_media case "rm" strUpFileType=UpFileType_rm case else strUpFileType="" end select SaveUpFilesPath="examimage" if right(SaveUpFilesPath,1)<>"/" then UploadDir="" & SaveUpFilesPath & "/" else UploadDir="" & SaveUpFilesPath end if TruePath=Server.MapPath(UploadDir) %> 从已上传文件选择 <% If not IsObjInstalled("Scripting.FileSystemObject") Then Response.Write "你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能" Else set fso=CreateObject("Scripting.FileSystemObject") call main() end if sub main() if fso.FolderExists(TruePath)=False then response.write "找不到文件夹!可能是配置有误!" exit sub end if FileCount=0 TotalSize=0 Set theFolder=fso.GetFolder(TruePath) For Each theFile In theFolder.Files strFileType=lcase(mid(theFile.Name,instrrev(theFile.Name,".")+1)) if instr(strUpFileType,strFileType)>0 then FileCount=FileCount+1 TotalSize=TotalSize+theFile.Size end if next if FileCount=0 then response.write "

 

 

没有找到任何" & DialogType & "文件!

" exit sub end if totalPut=FileCount if currentpage<1 then currentpage=1 end if if (currentpage-1)*MaxPerPage>totalput then if (totalPut mod MaxPerPage)=0 then currentpage= totalPut \ MaxPerPage else currentpage= totalPut \ MaxPerPage + 1 end if end if if currentPage=1 then showContent showpage2 strFileName,totalput,MaxPerPage response.write "
本页共显示 " & FileCount & " 个文件,占用 " & TotalSize_Page\1024 & " K
" else if (currentPage-1)*MaxPerPage
本页共显示 " & FileCount & " 个文件,占用 " & TotalSize_Page\1024 & " K
" else currentPage=1 showContent showpage2 strFileName,totalput,MaxPerPage response.write "
本页共显示 " & FileCount & " 个文件,占用 " & TotalSize_Page\1024 & " K
" end if end if end sub sub ShowContent() dim c FileCount=0 TotalSize_Page=0 %>
<% For Each theFile In theFolder.Files c=c+1 if FileCount>=MaxPerPage then exit for elseif c>MaxPerPage*(CurrentPage-1) then strFileType=lcase(mid(theFile.Name,instrrev(theFile.Name,".")+1)) if instr(strUpFileType,strFileType)>0 then %> <% FileCount=FileCount+1 if FileCount mod 4=0 then response.write "" TotalSize_Page=TotalSize_Page+theFile.Size end if end if Next %>
<% response.write "" select case strFileType case "jpg","gif","bmp","png" response.write "" case "swf" response.write "" case "wmv","avi","asf","mpg" response.write "" case "rm","ra","ram" response.write "" case "rar" response.write "" case "zip" response.write "" case "exe" response.write "" case else response.write "" end select %>
文 件 名: <%=theFile.Name%>
文件大小: <%=round(theFile.size/1024) & " K"%>
文件类型: <%=theFile.type%>
修改时间: <%=theFile.DateLastModified%>
<% end sub %>

<% sub showpage2(sfilename,totalnumber,maxperpage) dim n, i,strTemp if totalnumber mod maxperpage=0 then n= totalnumber \ maxperpage else n= totalnumber \ maxperpage+1 end if strTemp= "
" strTemp=strTemp & "共 " & totalnumber & " 个文件,占用 " & TotalSize\1024 & " K   " sfilename=JoinChar(sfilename) if CurrentPage<2 then strTemp=strTemp & "首页 上一页 " else strTemp=strTemp & "首页 " strTemp=strTemp & "上一页 " end if if n-currentpage<1 then strTemp=strTemp & "下一页 尾页" else strTemp=strTemp & "下一页 " strTemp=strTemp & "尾页" end if strTemp=strTemp & " 页次:" & CurrentPage & "/" & n & "页 " strTemp=strTemp & " " & maxperpage & "" & "个文件/页" strTemp=strTemp & " 转到:" strTemp=strTemp & "
" response.write strTemp end sub %>