请版主或各位大虾看看这两个文件哪里错了,这是一个图片上传的代码,谢谢
upfilex.asp
<!--#include file="CONN.ASP" -->
<%
Server.ScriptTimeOut=5000
dim Data_5xsoft
Class upload_5xsoft
  
dim objForm,objFile,Version
Public function Form(strForm)
   strForm=lcase(strForm)
   if not objForm.exists(strForm) then
     Form=""
   else
     Form=objForm(strForm)
   end if
 end function
Public function File(strFile)
   strFile=lcase(strFile)
   if not objFile.exists(strFile) then
     set File=new FileInfo
   else
     set File=objFile(strFile)
   end if
 end function
Private Sub Class_Initialize 
  dim RequestData,sStart,vbCrlf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,theFile
  dim iFileSize,sFilePath,sFileType,sFormValue,sFileName
  dim iFindStart,iFindEnd
  dim iFormStart,iFormEnd,sFormName
  Version=""
  set objForm=server.CreateObject("Scripting.Dictionary")
  set objFile=server.CreateObject("Scripting.Dictionary")
  if Request.TotalBytes<1 then Exit Sub
  set tStream = Server.CreateObject("adodb.stream")
  set Data_5xsoft = Server.CreateObject("adodb.stream")
  Data_5xsoft.Type = 1
  Data_5xsoft.Mode =3
  Data_5xsoft.Open
  Data_5xsoft.Write  Request.BinaryRead(Request.TotalBytes)
  Data_5xsoft.Position=0
  RequestData =Data_5xsoft.Read 
  iFormStart = 1
  iFormEnd = LenB(RequestData)
  vbCrlf = chrB(13) & chrB(10)
  sStart = MidB(RequestData,1, InStrB(iFormStart,RequestData,vbCrlf)-1)
  iStart = LenB (sStart)
  iFormStart=iFormStart+iStart+1
  while (iFormStart + 10) < iFormEnd 
 iInfoEnd = InStrB(iFormStart,RequestData,vbCrlf & vbCrlf)+3
 tStream.Type = 1
 tStream.Mode =3
 tStream.Open
 Data_5xsoft.Position = iFormStart
 Data_5xsoft.CopyTo tStream,iInfoEnd-iFormStart
 tStream.Position = 0
 tStream.Type = 2
 tStream.Charset ="gb2312"
 sInfo = tStream.ReadText
 tStream.Close
 '取得表单项目名称
 iFormStart = InStrB(iInfoEnd,RequestData,sStart)
 iFindStart = InStr(22,sInfo,"name=""",1)+6
 iFindEnd = InStr(iFindStart,sInfo,"""",1)
 sFormName = lcase(Mid (sinfo,iFindStart,iFindEnd-iFindStart))
 '如果是文件
 if InStr (45,sInfo,"filename=""",1) > 0 then
  set theFile=new FileInfo
  '取得文件名
  iFindStart = InStr(iFindEnd,sInfo,"filename=""",1)+10
  iFindEnd = InStr(iFindStart,sInfo,"""",1)
  sFileName = Mid (sinfo,iFindStart,iFindEnd-iFindStart)
  theFile.FileName=getFileName(sFileName)
  theFile.FilePath=getFilePath(sFileName)
  '取得文件类型
  iFindStart = InStr(iFindEnd,sInfo,"Content-Type: ",1)+14
  iFindEnd = InStr(iFindStart,sInfo,vbCr)
  theFile.FileType =Mid (sinfo,iFindStart,iFindEnd-iFindStart)
  theFile.FileStart =iInfoEnd
  theFile.FileSize = iFormStart -iInfoEnd -3
  theFile.FormName=sFormName
  if not objFile.Exists(sFormName) then
    objFile.add sFormName,theFile
  end if
 else
 '如果是表单项目
  tStream.Type =1
  tStream.Mode =3
  tStream.Open
  Data_5xsoft.Position = iInfoEnd 
  Data_5xsoft.CopyTo tStream,iFormStart-iInfoEnd-3
  tStream.Position = 0
  tStream.Type = 2
  tStream.Charset ="gb2312"
         sFormValue = tStream.ReadText 
         tStream.Close
  if objForm.Exists(sFormName) then
    objForm(sFormName)=objForm(sFormName)&", "&sFormValue    
  else
    objForm.Add sFormName,sFormValue
  end if
 end if
 iFormStart=iFormStart+iStart+1
 wend
  RequestData=""
  set tStream =nothing
End Sub
Private Sub Class_Terminate  
 if Request.TotalBytes>0 then
 objForm.RemoveAll
 objFile.RemoveAll
 set objForm=nothing
 set objFile=nothing
 Data_5xsoft.Close
 set Data_5xsoft =nothing
 end if
End Sub
   
 
 Private function GetFilePath(FullPath)
  If FullPath <> "" Then
   GetFilePath = left(FullPath,InStrRev(FullPath, "\"))
  Else
   GetFilePath = ""
  End If
 End  function
 
 Private function GetFileName(FullPath)
  If FullPath <> "" Then
   GetFileName = mid(FullPath,InStrRev(FullPath, "\")+1)
  Else
   GetFileName = ""
  End If
 End  function
End Class
Class FileInfo
  dim FormName,FileName,FilePath,FileSize,FileType,FileStart
  Private Sub Class_Initialize 
    FileName = ""
    FilePath = ""
    FileSize = 0
    FileStart= 0
    FormName = ""
    FileType = ""
  End Sub
  
 Public function SaveAs(FullPath)
    dim dr,ErrorChar,i
    SaveAs=true
    if trim(fullpath)="" or FileStart=0 or FileName="" or right(fullpath,1)="/" then exit function
    set dr=CreateObject("Adodb.Stream")
    dr.Mode=3
    dr.Type=1
    dr.Open
    Data_5xsoft.position=FileStart
    Data_5xsoft.copyto dr,FileSize
    dr.SaveToFile FullPath,2
    dr.Close
    set dr=nothing 
    SaveAs=false
  end function
End Class
'判断文件类型是否合格
Private Function CheckFileExt (fileEXT)
dim Forumupload,i
Forumupload="gif,jpg,bmp,jpeg,png"
Forumupload=split(Forumupload,",")
 for i=0 to ubound(Forumupload)
  if lcase(fileEXT)=lcase(trim(Forumupload(i))) then
   CheckFileExt=true
   exit Function
  else
   CheckFileExt=false
  end if
 next
End Function
dim rs,sql,upload,user,upfiles,rsupfiles
set upload=new upload_5xsoft ''建立上传对象
user=request.cookies("renwen")("user")
upfiles=4
if user="" or request.cookies("renwen")("passedok")<>"ofdkjduy" then
response.Write("此页面为注册用户页,请注册!")
response.End()
end if
set rs=server.createobject("adodb.recordset")
sql="select time from upfile where datediff('d',time,Now())<1 and lb<>'face' order by id desc"
rs.open sql,conn,1,1
rsupfiles=rs.recordcount
sub uploadfileclass() '上传文件子程序
dim lb,file,formName,formPath,iCount,ranNum,fileExt,FileName,rs,Extarry,outcode
lb=upload.Form("lb")
'iCount=0
'if upload.form("filepath")="" then   ''得到上传目录
' HtmEnd "请输入要上传至的目录!"
' set upload=nothing
 'response.end
'else
' formPath=upload.form("filepath")
 ''在目录后加(/)
 'if right(formPath,1)<>"/" then formPath=formPath&"/" 
'end if
'for each formName in upload.objForm ''列出所有form数据
' response.write formName&"="&upload.form(formName)&"<br>"
'next
'response.write "<br>"
'for each formName in upload.objFile   ''列出所有上传了的文件
response.Write("<link href=""DEFAULT.css"" rel=""stylesheet"" type=""text/css""><body bgcolor=#FFFFFF text=#000000 topmargin=0 marginwidth=0 marginheight=0>")
 set file=upload.file("file1")    ''生成一个文件对象
  if file.FileSize>409600 then 
  response.Write("上传文件,超出大小!请重新上传.<a href=?lb="&lb&">返回</a>")
  exit sub
  end if
  if file.FileSize>0 then 
  
    randomize
    Extarry=split(file.FileName,".")
 fileExt=Extarry(ubound(Extarry))
    ranNum=int(90000*rnd)+10000
 if CheckFileExt(fileExt)=false then
    response.Write("文件类型不符.请注意上传规定的文件类型!<a href=?lb="&lb&">返回</a>")
 exit sub
 end if
 if rsupfiles>=upfiles and lb<>"face" then
    response.Write("你今天已经上传了 "&upfiles&" 个文件了,每天可以上传 "&upfiles&" 个文件")
    exit sub
    end if
'    FileName=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
'    response.write file.FilePath&file.FileName&" ("&file.FileSize&") => "&formPath&File.FileName&" 成功!<br>"
     if lb="face" then '如果是上头像,以用户名为文件名,改变上传目录
     FileName="upface/"&user&"."&fileExt '确定上传目录,上传文件名
     outcode="头像上传结束! [<a href=?lb="&lb&">返回</a>]<script>parent.document.form1.myface.value='"&filename&"'</script>"
  else
     FileName="upimg/"&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt '确定上传目录,上传文件名
     outcode=" 1个文件上传结束! [<a href=?lb="&lb&">返回</a>]<script>parent.document.FORM1.ly.value+='[IMG]" &filename& "[/IMG]'</script>"
     end if
 file.SaveAs Server.MapPath(FileName)
    else
    response.Write("请选择要上传的文件.<a href=?lb="&lb&">返回</a>")
    exit sub
   end if
'看是否有上传头像 如果有-更新数据,如否添加记录
   if lb="face" and (not conn.execute("select user from upfile where user='"&user&"' and lb='face'").eof) then
     conn.execute("update upfile set [user]='"&user&"',[pic]='"&FileName&"',[time]=now(),[size]='"&file.FileSize&"',[lb]='"&lb&"',[F_type]='"&fileExt&"' where user='"&user&"' and lb='face'")
   else
     conn.execute("insert into upfile([user],[pic],[time],[size],[lb],[F_type]) values ('"&user&"','"&FileName&"',now(),'"&file.FileSize&"','"&lb&"','"&fileExt&"')")
   end if     
   response.write(outcode)
   set file=nothing
   set upload=nothing  ''删除此对象
end sub
if upload.Form("Submit")<>"" then
call uploadfileclass()
else
set upload=nothing
%>
<html>
<head>
<title>文件上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="DEFAULT.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" marginwidth="0" marginheight="0">
<%
if rsupfiles>=upfiles and request.QueryString("lb")<>"face" then
response.Write("你今天已经上传了 "&upfiles&" 个文件了,每天最多上传 "&upfiles&" 个文件")
else
%>
<form name="form1" method="post" action="upfilex.asp" enctype="multipart/form-data" >
  <table width="542" border="0" cellpadding="0" cellspacing="0">
    <tr> 
      <td width="206"> 
        <input type="file" name="file1" value=""></td>
      <td width="336"> 
        <input type="submit" name="Submit" value="提交">
        <input type="hidden" name="upcount" value="1">
        <input name="lb" type="hidden" id="lb" value="<%=request.QueryString("lb")%>">
        你还可上传:<b><%=upfiles-rsupfiles%></b>个文件 每天<b><%=upfiles%></b>文件 每个400K</td>
    </tr>
  </table>
</form>
<%end if%>
</body>
</html>
<%end if%>
AddIn.asp
<!--#include file="CONN.ASP" -->
<%
dim rs,sql,name,ly,czlb,id,rid,lb
if not userislogin then
founderr=true
errmess=errmess&error1
end if
if userloginlock=1 then
founderr=true
errmess=errmess&error2
end if
'加入数据子程序
sub addIntoData()
dim czlb,id,rid,lysting
id=request.Form("id")
rid=request.Form("rid")
czlb=request.Form("czlb")
if id<>"" and czlb<>"addtz" then
call checkiflocked(id)
end if
if founderr then
exit sub
end if
set rs=server.createobject("adodb.recordset")
select case czlb
case "addtz"
call updateftuser(true)
sql="select * from borecorder"
rs.open sql,conn,1,3
rs.addnew
rs("retime")=now()
lysting=request.form("ly")
case "edittz"
sql="select * from borecorder where id="&id
rs.open sql,conn,1,3
lysting=request.form("ly")&vbCrlf&vbCrlf&" 此帖已被修改过,修改时间为:"&now()
case "retz"
call updateftuser(false)
sql="select * from rely"
rs.open sql,conn,1,3
rs.addnew
rs("rid")=id
lysting=request.form("ly")
case "editretz"
sql="select * from rely where id="&rid
rs.open sql,conn,1,3
lysting=(request.form("ly")&vbCrlf&vbCrlf&" 此帖已被修改过,修改时间为:"&now())
case "vote"
call updateftuser(false)
sql="select * from rely"
rs.open sql,conn,1,3
rs.addnew
lysting=request.form("ly")
rs("rid")=id
case "revote"
call updateftuser(false)
sql="select * from rely"
rs.open sql,conn,1,3
rs.addnew
lysting=request.form("ly")
rs("rid")=id
case "editvote"
sql="select * from rely where id="&rid
rs.open sql,conn,1,3
lysting=request.form("ly")&vbCrlf&vbCrlf&" 此帖已被修改过,修改时间为:"&now()
end select
rs("name")=request.form("name")
rs("heat")=request.form("heat")
rs("ly")=lysting
rs("lb")=request.form("lb")
rs("user")=loginuser
rs("time")=now()
rs("ip")=Request.ServerVariables("REMOTE_ADDR")
if id="" then 
id=rs("id")
end if
rs.update
founderr=true
errmess=errmess&"<li>你的帖子已经成功的发到论坛了,3 秒钟自动返回你所发表的帖子."
errmess=errmess&"<script>window.tm = setInterval(""location.href='type.asp?id="&id&"'"", 3000)</script>"
errmess=errmess&"<li> <li>"&thispage_name(request.ServerVariables("SCRIPT_NAME"),"url")
errmess=errmess&"<li> <li><a href=type.asp?id="&id&">你所发表的帖子</a>"
end sub
if request.form("sublit")<>"" then
addIntoData()
else
czlb=request.QueryString("czlb")
lb=request.QueryString("lb")
id=request.QueryString("id")
rid=request.QueryString("rid")
if czlb="" or lb="" then
founderr=true
errmess=errmess+"<li>对不起发现参数错误,这可能是由于你没有从正确的链接进入.请回<a href=index.asp>论坛</a>"
end if
if (czlb<>"addtz") and id="" then
founderr=true
errmess=errmess+"<li>对不起!发现参数错误,这可能是由于你没有从正确的链接进入.请回<a href=index.asp>论坛</a>"
end if
if (czlb="editretz" or czlb="editvote" or czlb="revote") and rid="" then
founderr=true
errmess=errmess+"<li>对不起!发现参数错误,这可能是由于你没有从正确的链接进入.请回<a href=index.asp>论坛</a>"
end if
select case czlb
case "addtz"
name="" 
ly=""
case "edittz"
set rs=conn.execute("select name,ly from borecorder where id="&id&" and user='"&loginuser&"'")
if not rs.eof then
name=rs("name")
ly=rs("ly")
else
founderr=true
errmess=errmess+"<li>对不起!无法显示你要编辑的帖子.<li>原因: 你可能没有编辑此帖子的权限请注意从正确链接 <a href=index.asp>进入</a>"
end if
case "retz"
set rs=conn.execute("select name,lock from borecorder where id="&id)
if not rs.eof then
name="[回复:]"&rs("name")
else
founderr=true
errmess=errmess+"<li>对不起!没有找到你回复所指向的帖子.请从正确链接<a href=index.asp>进入</a>"
end if
case "editretz"
set rs=conn.execute("select name,ly from rely where id="&rid&" and user='"&loginuser&"'")
if not rs.eof then
name=rs("name")
ly=rs("ly")
else
founderr=true
errmess=errmess+"<li>对不起!无法显示你要编辑的帖子.<li>原因: 你可能没有编辑此帖子的权限.请注意从正确链接 <a href=index.asp>进入</a>"
end if
case "vote"
set rs=conn.execute("select name,user,time,ly,lock from borecorder where id="&id)
if not rs.eof then
name="[引用]:"&rs("name")
ly="
else
founderr=true
errmess=errmess+"<li>对不起!没有找到你引用所指向的帖子.请从正确链接<a href=index.asp>进入</a>"
end if
case "editvote"
set rs=conn.execute("select name,ly from rely where id="&rid&" and user='"&loginuser&"'")
if not rs.eof then
name=rs("name")
ly=rs("ly")
else
founderr=true
errmess=errmess+"<li>对不起!无法显示你要编辑的帖子.<li>原因: 你可能没有编辑此帖子的权限.请注意从正确链接<a href=index.asp>进入</a>"
end if
case "revote"
set rs=conn.execute("select name,user,time,ly from rely where id="&rid)
if not rs.eof then
name="[引用]:"&rs("name")
ly="
else
founderr=true
errmess=errmess+"<li>对不起!没有找到你引用所指向的帖子.请从正确链接<a href=index.asp>进入</a>"
end if
end select
end if
'检查帖子是否被锁定
sub checkiflocked(lockid)
dim rs
set rs=conn.execute("select lock from borecorder where id="&lockid)
if rs("lock")="locked" then
founderr=true
messerr=messerr&"<li>对不起!此帖子已被管理员锁定,不再接受回复.<li><a href=type.asp?id="&lockid&">返回帖子</a>"
end if
end sub
%>
<!--#include file="mymem.asp" -->
<SCRIPT language=javascript id=clientEventHandlersJS>
<!--
function form1_onsubmit() 
{
  if(document.FORM1.name.value.length<1)
 {
   alert("你忘了输入标题了");
   document.FORM1.name.focus();
   return false;
 }
   if(document.FORM1.ly.value.length<1)
 {
   alert("请填写好你要发表的内容");
   document.FORM1.ly.focus();
   return false;
  }
}
function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="sublit"||tempobj.Reset.toLowerCase()=="reset")
//disable em
tempobj.disabled=true
}
}
}
//-->
</SCRIPT>
<FORM name=FORM1 onSubmit="return form1_onsubmit()" action=AddIn.asp?lb=<%=lb%>&czlb=ok method=post>
 <table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> 
      <td width="787" height="19"> </td>
    </tr>
    <tr>
      <td> 
<%
if founderr then
founderror(errmess)
end if
call tabletop(true,"top")
%>
        <table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#92b9fb">
          <tr bgcolor="#92b9fb" background="backimg/bg1.gif"> 
            <td height="27" colspan="2" background="backimg/bg1.gif"> <input name="lb" type="hidden" id="lb" value="<%=lb%>"> 
              <input name="czlb" type="hidden" id="czlb" value="<%=czlb%>"> 
              <input name="id" type="hidden" id="id" value="<%=id%>"> 
              <input name="rid" type="hidden" id="rid" value="<%=rid%>"> 
              <font color="#FFFFFF"><strong>论坛发帖子 </strong></font></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="19%"><b>主题标题</b><SELECT name=fonta onchange="document.FORM1.name.value+=fonta.value">
              <OPTION selected value="">选择话题</OPTION> 
     <OPTION value=[原创]>[原创]</OPTION> 
              <OPTION value=[转帖]>[转帖]</OPTION> 
     <OPTION value=[灌水]>[灌水]</OPTION> 
              <OPTION value=[讨论]>[讨论]</OPTION> 
     <OPTION value=[求助]>[求助]</OPTION> 
              <OPTION value=[推荐]>[推荐]</OPTION> 
     <OPTION value=[公告]>[公告]</OPTION> 
              <OPTION value=[注意]>[注意]</OPTION> 
     <OPTION value=[贴图]>[贴图]</OPTION>
              <OPTION value=[建议]>[建议]</OPTION> 
     <OPTION value=[下载]>[下载]</OPTION>
              <OPTION value=[分享]>[分享]</OPTION>
     </SELECT>
     </td>
            <td width="81%"> <input name="name" type="text" id="tzname" value="<%=name%>" size="60" maxlength="100" > 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="19%"><strong>文件上传</strong> <a href="#" title="gif<br>jpg<br>bmp<br>jpeg<br>png">类型</a> <br> </td>
            <td bgcolor="#FFFFFF">
   
   
   <iframe src="upfilex.asp?lb=<%=Request.QueryString("lb")%>" width="610" height="30" frameborder=0 style="over-flow:auto" id="fff" >
              </iframe>
   
   
   
    </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="19%"> <strong>发帖心情</strong>: </td>
            <td width="81%" rowspan="2"> <!--#include file="getubb.asp" --> <textarea name="ly" rows="12" wrap="file" cols="75" title="按Ctrl+Enter可提交帖子" onkeydown=ctlent()><%=ly%></textarea> 
              <br> 
<%
call listpicimg()
sub listpicimg()
dim i
for i=1 to 28
 if len(i)=1 then i="0" & i
 response.write "<img src=""pic/em"&i&".gif"" border=0 onclick=""insertsmilie('[em"&i&"]')"" style=""CURSOR: hand""> "
if i=14 then
response.write"<br>"
end if
next
end sub
%> </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="19%" height="231"> <strong>内容</strong><br>
<%
if cint(bbs_seting(2))=1 then
response.Write("HTML代码:不支持")
else
response.Write("HTML代码:支持")
end if
if cint(bbs_seting(3))=0 then
response.Write("<br>UBB代码:不支持")
else
response.Write("<br><a href=helpubb.asp>UBB</a>代码:支持")
end if
%></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td colspan="2" align="center"> 
              <input name=sublit type=submit id="sublit" value="提 交">    
              <input type="reset" tolowercase name="Reset" value="重 填"> </td>
          </tr>
        </table>
        <%call tabletop(true,"down")%>
      </td>
    </tr>
    <tr> 
      <td> </td>
    </tr>
  </table>
<script language=javascript>
ie = (document.all)? true:false
if (ie){
function ctlent(eventobject){if(event.ctrlKey && window.event.keyCode==13){this.document.FORM1.submit();}}
}
</script>
</FORM>
<%
response.Write(loadcopyc("copyc"))
response.write "Powered By :obbs Version 1.0.1<br>Copyright ©2002 - 2003 <a href=http://www.mtvok.com target=""_blank""><b>mtvok.com</b></a>,页面执行时间: "& cint((timer()-startime)*1000)&" 毫秒</div>"
%>
</body>
</html>



											
	    

	