| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 398 人关注过本帖
标题:页面出错,求高手帮忙!!
只看楼主 加入收藏
fujian567
Rank: 2
等 级:论坛游民
帖 子:29
专家分:20
注 册:2010-5-17
结帖率:100%
收藏
 问题点数:0 回复次数:1 
页面出错,求高手帮忙!!
<%@LANGUAGE="VBSCRIPT"%>   
<%
set   fs=CreateObject("Scripting.FileSystemObject")
if request.QueryString("act")="del" then
   if fs.fileexists server.MapPath("../upfile") & "\" & request.QueryString("file")   Then  
    response.write "<script language=JavaScript>" & "alert('文件不存在!');"  & "</script>"
    else
     fs.Deletefile server.MapPath("../upfile") & "\" & request.QueryString("file")
   response.write "<script language=JavaScript>" & "alert('删除成功!');"  & "</script>"
  end if
end if
%>  
  <html>   
  <head>   
  <META   http-equiv=Content-type   content=text/html;charset=GB2312>
  <link href="Images/css1/css.css" rel="stylesheet" type="text/css">   
  </head>   
  <body>   
  <%   
  on   error   resume   next        
  PageCount=15'                                                                        
  strFileName="admin_upfile.asp"   
  strdir="../upfile/"'                                                                       
  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   
   
  if   request("page")<>""   then   
          currentPage=cint(request("page"))     
  else   
          currentPage=1   
  end   if   
  MaxPerPage=PageCount   
  UploadDir   =   request("parentPath")               
  if   UploadDir=""   then   UploadDir=strdir   
  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   fso.FolderExists(TruePath)then
  FileCount=0   
  subFolderCount=0   
  TotleSize=0   
  TotleSize2=0   
  Set   theFolder=fso.GetFolder(TruePath)   
          For   Each   thesubfolder   in   theFolder.SubFolders   
                  subFolderCount=subFolderCount+1   
          Next   
  For   Each   theFile   In   theFolder.Files
  FileCount=FileCount+1                       
  TotleSize2=TotleSize2+theFile.Size        
  next   
  totalPut=FileCount+subFolderCount         
  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,UploadDir   
  response.write   "<br/><div   align='center'>本页共显示   <b>"   &   FileCount   &   "</b>   个文件,占用   <b>"   &   TotleSize\1024   &   "</b>   K</div>"   
  else   
  if   (currentPage-1)*MaxPerPage<totalPut   then   
  showContent            
  showpage2   strFileName,totalput,MaxPerPage,UploadDir   
  response.write   "<br/><div   align='center'>本页共显示   <b>"   &   FileCount   &   "</b>   个文件,占用   <b>"   &   TotleSize\1024   &   "</b>   K</div>"   
  else   
  currentPage=1   
  showContent            
  showpage2   strFileName,totalput,MaxPerPage,UploadDir   
  response.write   "<br/><div   align='center'>本页共显示   <b>"   &   FileCount   &   "</b>   个文件,占用   <b>"   &   TotleSize\1024   &   "</b>   K</div>"   
  end   if   
  end   if   
      else   
  response.write   "找不到文件夹!可能是配置有误!"   
      end   if   
  end   if   
   
  sub   showContent()
        dim   c   
  FileCount=0   
  TotleSize=0   
  %>     
  <table   width="95%"   border="1"   cellspacing="0"   cellpadding="3"   align="center"   bordercolorlight="#ECEEE4"   bordercolordark="#CCCABC">   
            <tr>     
              <td   colspan="5"   align="center"   height="30"   background="image/tablebg.gif"><b>上               理</b>   </td>   
          </tr>   
          <tr   align="center"   valign="middle">     
  <td width="17%"   height="25">文件名</td>   
  <td width="23%"   height="25">文件大小</td>
  <td width="20%"   height="25">文件预览</td>  
  <td width="20%"   height="25">最后修改时间</td>   
  <td width="20%"   height="25">操作</td>   
  </tr>   
  <%   
  if   UploadDir<>strdir   then   
  %>   
  <%   
  end   if   
          For   Each   thesubfolder   in   theFolder.SubFolders   
  c=c+1   
  if   FileCount>=MaxPerPage   then   
  exit   for   
  elseif   c>MaxPerPage*(CurrentPage-1)   then   
  %>   
  <%   
  FileCount=FileCount+1   
  end   if   
  Next   
  For   Each   theFile   In   theFolder.Files
  c=c+1   
  if   FileCount>=MaxPerPage   then   
  exit   for   
  elseif   c>MaxPerPage*(CurrentPage-1)   then   
  %>   
  <tr   align="center"   valign="middle">   
  <td   height="25"><a   href="<%=(UploadDir &   theFile.Name)%>"   target="_blank"><strong>   
   
  <%   
  ba=split(theFile.Name)   
  response.write   ba(0)   
  %>   
  </strong></a></td>   
  <td   height="25"><%=theFile.size\1024%>KB</td>
  <td   height="25"><img src="../upfile/<%=ba(0)%>" width="40" height="40"></td>   
  <td   height="25"><%=theFile.DateLastModified%></td>   
  <td   height="25"><a href="admin_upfile.asp?act=del&file=<%=ba(0)%>" onClick="javascript:return confirm('您确定要删除此文件吗?');">删除</a></td>   
  </tr>   
  <%   
  FileCount=FileCount+1   
  TotleSize=TotleSize+theFile.Size   
  end   if   
  Next   
  %>   
  </table>   
  
  <br><%   
  end   sub   
   
  sub   showpage2(sfilename,totalnumber,maxperpage,parentPath)
  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   name='showpages'   method='Post'   action='"   &   sfilename   &   "'><tr><td>"   
  strTemp=strTemp   &   "共   <b>"   &   totalnumber   &   "</b>   个文件,占用   <b>"   &   TotleSize2\1024   &   "</b>   K&nbsp;&nbsp;&nbsp;"   
  if   CurrentPage<2   then   
          strTemp=strTemp   &   "首页   上一页&nbsp;"   
  else   
          strTemp=strTemp   &   "<a   href='"   &   sfilename   &   "?page=1&parentPath="&   parentPath   &"'>首页</a>&nbsp;"   
          strTemp=strTemp   &   "<a   href='"   &   sfilename   &   "?page="   &   (CurrentPage-1)   &   "&parentPath="&   parentPath   &"'>上一页</a>&nbsp;"   
    end   if     
  if   n-currentpage<1   then   
          strTemp=strTemp   &   "下一页   尾页"   
  else   
          strTemp=strTemp   &   "<a   href='"   &   sfilename   &   "?page="   &   (CurrentPage+1)   &   "&parentPath="&   parentPath   &"'>下一页</a>&nbsp;"   
          strTemp=strTemp   &   "<a   href='"   &   sfilename   &   "?page="   &   n   &   "&parentPath="&   parentPath   &"'>尾页</a>"   
      end   if   
        strTemp=strTemp   &   "&nbsp;页次:<strong><font   color=red>"   &   CurrentPage   &   "</font>/"   &   n   &   "</strong>页   "   
        strTemp=strTemp   &   "&nbsp;<b>"   &   maxperpage   &   "</b>"   &   "个文件/页"   
  strTemp=strTemp   &   "</select>"   
  strTemp=strTemp   &   "<input   type=hidden   name=parentPath   value="&parentPath&">"   
  strTemp=strTemp   &   "</td></tr></form></table>"   
  response.write   strTemp   
  end   sub   
  %>   
  </body>   
  </html>
当我直接使用删除,不检查文件存不存在时,是好的,但是加上检查文件是否存在时,就会报错
报错显示
Microsoft VBScript 编译器错误 '800a03f9'

缺少 'Then'

\admin\admin_upfile.asp, line 5

搜索更多相关主题的帖子: 页面 
2010-05-29 16:33
fujian567
Rank: 2
等 级:论坛游民
帖 子:29
专家分:20
注 册:2010-5-17
收藏
得分:0 
问题已经解决了,很感谢大家的关注!
2010-05-29 16:50
快速回复:页面出错,求高手帮忙!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015572 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved