这是整个文件。在点击转到下一页时出现以下错误,请版主帮忙解决!
Microsoft VBScript 运行时错误 错误 '800a000d'
类型不匹配: '[string: ""]'
/admin/upFileManage.asp,行44
<%if session("admin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆!');window.location.href='login.asp';</script>"
response.End
else
if session("flag")=2 then
response.Write "<p align=center><font color=red>您没有此项目管理权限!</font></p>"
response.End
end if
end if
%>
<!--#include file =conn.asp-->
<head>
<link rel="stylesheet" type="text/css" href="../images/css.css">
</head>
<SCRIPT language = "JavaScript">
<!--//
function unselectall()
{
if(document.myform.chkAll.checked){
document.myform.chkAll.checked = document.myform.chkAll.checked&0;
}
}
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.Name != "chkAll")
e.checked = form.chkAll.checked;
}
}
//-->
</script>
<%
dim MaxPerPage
dim strFileName,path,FileName
dim totalPut,CurrentPage,TotalPages,FilePath
dim UploadDir,TruePath,fso,theFolder,theFile,whichfile,thisfile,FileCount,TotleSize
strFileName="upFileManage.asp"
viewtype=Request("viewtype")
if viewtype=1 then
MaxPerPage=15
else
MaxPerPage=35
end if
if request("path")<>"" then
path=request("path")
else
path="../bookpic/"
end if
if request("page")<>"" then
currentPage=cint(request("page"))
else
currentPage=1
end if
if right(path,1)<>"/" then
UploadDir="" & path & "/"
else
UploadDir="" & path
end if
TruePath=Server.MapPath(UploadDir)
If not IsObjInstalled("Scripting.FileSystemObject") Then
Response.Write "<b><font color=red>你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能</font></b>"
Else
set fso=CreateObject("Scripting.FileSystemObject")
if request("Action")="Del" then
call DelFiles()
end if
function gotTopic(str,strlen)
if str="" then
gotTopic=""
exit function
end if
dim l,t,c, i
str=replace(replace(replace(replace(str," "," "),""",chr(34)),">",">"),"<","<")
l=len(str)
t=0
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then
gotTopic=left(str,i) & "…"
exit for
else
gotTopic=str
end if
next
gotTopic=replace(replace(replace(replace(gotTopic," "," "),chr(34),"""),">",">"),"<","<")
end function
function JoinChar(strUrl)
if strUrl="" then
JoinChar=""
exit function
end if
if InStr(strUrl,"?")<len(strUrl) then
if InStr(strUrl,"?")>1 then
if InStr(strUrl,"&")<len(strUrl) then
JoinChar=strUrl & "&"
else
JoinChar=strUrl
end if
else
JoinChar=strUrl & "?"
end if
else
JoinChar=strUrl
end if
end function
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 GetPath '###获取路径
dim s
s=Request.ServerVariables("path_translated")
GetPath=left(s,instrrev(s,"\",len(s)))
End function
%>
<script language="JavaScript">
function ConfirmDel()
{
if (confirm("你真的要删除此文件吗!"))
return true;
else
return false;
}
</script>
<div align="center">
<table width="96%" border="0" cellspacing="1" class="tableBorder" style="background-color: #E8F1FF">
<tr><th height="22" background="images/bg_3.gif">上传文件管理</th></tr>
<tr>
<td class="forumRowHighlight" height=23> <b>注意</b>:<BR>本功能必须服务器支持FSO权限方能使用,FSO使用帮助请浏览微软网站。如果您服务器不支持FSO请手动管理。<BR></td>
</tr>
<form method="POST" action="?action=pathname">
<tr>
<td class="forumRowHighlight" height=23> <input type="text" name="path" value=<%=path%> size="40" class="td2"> <input type="checkbox" name="viewtype" value="1" <% if viewtype=1 then %> checked <% end if %>>缩略图
<input type="submit" value="确认提交" class="button">
(<font color=red>请填写正确的文件夹名或路径</font>)</td>
</tr>
</form>
<tr><td height="22" align="center" class="forumRow"><b>当前浏览 <%=path%> 目录的所有文件列表如下</b></td></form></td></tr>
</table>
</div>
<%
if fso.FolderExists(TruePath)then
FileCount=0
TotleSize=0
Set theFolder=fso.GetFolder(TruePath)
For Each theFile In theFolder.Files
FileCount=FileCount+1
TotleSize=TotleSize+theFile.Size
next
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
showpage2 strFileName,totalput,MaxPerPage
showContent
showpage2 strFileName,totalput,MaxPerPage
else
if (currentPage-1)*MaxPerPage<totalPut then
showpage2 strFileName,totalput,MaxPerPage
showContent
showpage2 strFileName,totalput,MaxPerPage
else
currentPage=1
showpage2 strFileName,totalput,MaxPerPage
showContent
showpage2 strFileName,totalput,MaxPerPage
end if
end if
else
response.write "找不到文件夹!可能是配置有误!"
end if
end if
sub showContent()
dim c
FileCount=0
TotleSize=0
%>
<div align="center">
<table width="966" border="0" cellspacing="1" class="tableBorder" style="background-color: #E8F1FF">
<form name="myform" method="post" action="" onsubmit="return confirm('确定要删除选中的文件吗?');">
<tr><th height="20" width="35"> </th>
<th height="20" width="196">文件名</th>
<th height="20">文件大小</th>
<th height="20">文件类型</th>
<th height="20">最后修改时间</th>
</tr>
<%
For Each theFile In theFolder.Files
if Not Response.IsClientConnected then responseend
c=c+1
if FileCount>=MaxPerPage then
exit for
elseif c>MaxPerPage*(CurrentPage-1) then
%>
<tr>
<td width="35" class="forumRowHighlight"><input type="checkbox" name="FileName" value="<%=theFile.Name%>" title="<%=theFile.Name%>"></td>
<td width="196" class="forumRowHighlight" align="center"><a href="<%=(UploadDir & theFile.Name)%>" target="_blank">
<% if viewtype<>1 then %>
<%=theFile.Name%>
<% else %>
<img src="<%=UploadDir & theFile.Name%>" width="100" border="0"><br>fdf<%=theFile.Name%>
<% end if %>
</a></td>
<td width="151" align="right" class="forumRow"><%=theFile.size%>字节</td>
<td width="235" align="center" class="forumRow"><%=theFile.type%></td>
<td width="235" align="center" class="forumRow"><%=theFile.DateLastModified%></td>
</tr>
<%
FileCount=FileCount+1
TotleSize=TotleSize+theFile.Size
end if
Next
%>
<tr><td class="forumRow" align="center" colspan="5"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">全选/反选
<input name="Action" type="hidden" id="Action" value="Del">
<input type="submit" name="Submit" value="删除选中的文件" class="button"></td></tr>
</form>
</table>
</div>
<%
end sub
%>
</body>
</html>
<%
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= "<table align='center'><form method='Post' action='" & sfilename & "?path="&request("path")& "&viewtype=" & viewtype &"'><tr><td>"
strTemp=strTemp & "共 <b>" & totalnumber & "</b> 个文件,占用 <b>" & TotleSize\1024 & "</b> K "
sfilename=JoinChar(sfilename)
if CurrentPage<2 then
strTemp=strTemp & "首页 上一页 "
else
strTemp=strTemp & "<a href='" & sfilename & "page=1&path="&request("path")& "&viewtype=" & viewtype & "'>首页</a> "
strTemp=strTemp & "<a href='" & sfilename & "page=" & (CurrentPage-1) & "&viewtype=" & viewtype & "&path="&request("path")&"'>上一页</a> "
end if
if n-currentpage<1 then
strTemp=strTemp & "下一页 尾页"
else
strTemp=strTemp & "<a href='" & sfilename & "page=" & (CurrentPage+1) & "&viewtype=" & viewtype & "&path="&request("path")&"'>下一页</a> "
strTemp=strTemp & "<a href='" & sfilename & "page=" & n & "&path="&request("path")& "&viewtype=" & viewtype &"'>尾页</a>"
end if
strTemp=strTemp & " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
strTemp=strTemp & " <b>" & maxperpage & "</b>" & "个文件/页"
strTemp=strTemp & " 转到:<select name='page' size='1' onchange='javascript:submit()'>"
for i = 1 to n
strTemp=strTemp & "<option value='" & i & "'"
if cint(CurrentPage)=cint(i) then strTemp=strTemp & " selected "
strTemp=strTemp & ">第" & i & "页</option>"
next
strTemp=strTemp & "</select>"
strTemp=strTemp & "</td></tr></form></table>"
response.write strTemp
end sub
sub DelFiles()
dim whichfile,arrFileName,i
whichfile=trim(Request("FileName"))
if whichfile="" then exit sub
if instr(whichfile,",")>0 then
arrFileName=split(whichfile,",")
for i=0 to ubound(arrFileName)
if left(trim(arrFileName(i)),3)<>"../" and left(trim(arrFileName(i)),1)<>"/" then
whichfile=server.MapPath(UploadDir & trim(arrFileName(i)))
set thisfile=fso.GetFile(whichfile)
thisfile.Delete True
end if
next
else
if left(whichfile,3)<>"../" and left(whichfile,1)<>"/" then
Set thisfile = fso.GetFile(server.MapPath(UploadDir & whichfile))
thisfile.Delete True
end if
Response.Redirect(""&Request.ServerVariables("HTTP_REFERER")&"")
end if
end sub
%>