照片不能上传,出现错误,Microsoft VBScript 运行时错误 '800a01a8' 请高手帮助!
Microsoft VBScript 运行时错误 '800a01a8' 缺少对象: 'upload.File(...)'
\u_mod.asp, line 1263
具体语句如下:
rem 上传处理
'文件上传处理
dim upNum,maxNum,file_size,filename8848_1,filename8848_2
maxNum=9999 '最大上传数量
file_size=300 '最大文件大小300K
'Server.ScriptTimeOut=999999
dim upload,formPath
set upload=new upload_5xSoft ''建立上传对象
formPath=upload.form("filepath")
if right(formPath,1)<>"/" then formPath=formPath&"/" ''在目录后加(/)
dim iCount,formName
int contnum
iCount=0
contnum=1
dim photo
For i=1 to 2 ''列出所有上传了的文件
photo="photo"&contnum
dim file
set file=upload.file(photo) ''生成一个文件对象
If i=1 and file.filesize>(1500*1024) Then
errmsg=errmsg+"<br>"+"<li>小图片必须是15K以内大小,请检查。"
founderr=true
Elseif i=2 and file.filesize>(cint(file_size)*1024) Then
errmsg=errmsg+"<br>"+"<li>大图片大小超过了限制(应小于300K),请检查。"
founderr=true
End If
'If file.filesize>(cint(file_size)*1024) Then
' errmsg=errmsg+"<br>"+"<li>图片大小超过了限制(应小于100K),请检查。"
' founderr=true
' End If
dim fileExt
fileExt=lcase(right(file.filename,4))
if fileEXT <>"" and fileEXT<>".gif" and fileEXT<>".jpg" and fileEXT<>".bmp" then
errmsg=errmsg+"<br>"+"<li>文件格式不对(只能为.gif或.jpg或.bmp文件),请检查。"
founderr=true
end if
'dim ranNum,picname,filename
' randomize
'ranNum=int(90000*rnd)+10000
if contnum=1 then picname=id&"_"&contnum&fileExt
if contnum=2 then picname=id&"_"&contnum&fileExt
If file.FileSize>0 Then
filename=formPath&picname
Else
filename=""
End If
if founderr then exit sub
If file.FileSize>0 Then'如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath(filename)'保存文件
if contnum=1 then filename8848_1=picname
if contnum=2 then filename8848_2=picname
End If
'更新数据库
if filename8848_1<>"" and filename8848_2<>"" then
set rs=Server.CreateObject("ADODB.recordset")
Rs.Open "select photo_x,photo_d,photo_x_flag,photo_d_flag from love_main where username='"&username&"'",conn,1,3
rs("photo_x")=filename8848_1
rs("photo_d")=filename8848_2
rs("photo_x_flag")=photo_x_flag
rs("photo_d_flag")=photo_x_flag
rs.update
rs.close
'conn.execute "update love_main set photo_x='"&filename8848_1&"',photo_d='"&filename8848_2&"',photo_x_flag='&photo_x_flag& ,photo_d_flag="&photo_x_flag&" where username='"&username&"'"
elseif filename8848_1<>"" and filename8848_2="" then
set rs=Server.CreateObject("ADODB.recordset")
Rs.Open "select photo_x,photo_x_flag from love_main where username='"&username&"'",conn,1,3
rs("photo_x")=filename8848_1
rs("photo_x_flag")=photo_x_flag
rs.update
rs.close
'conn.execute "update love_main set photo_x='"&filename8848_1&"',photo_x_flag="&photo_x_flag&" where username='"&username&"'"
elseif filename8848_1="" and filename8848_2<>"" then
set rs=Server.CreateObject("ADODB.recordset")
Rs.Open "select photo_d,photo_d_flag from love_main where username='"&username&"'",conn,1,3
rs("photo_d")=filename8848_2
rs("photo_d_flag")=photo_x_flag
rs.update
rs.close
'conn.execute "update love_main set photo_d='"&filename8848_2&"',photo_d_flag="&photo_x_flag&" where username='"&username&"'"
end if
'更新数据库结束
if filename8848_1<>"" and contnum<>2 then response.write"<br><li>小图片上传成功,请等待管理员审核。<br>"
if filename8848_2<>"" and contnum<>1 then response.write"<br><li>大图片上传成功,请等待管理员审核。"
contnum=contnum+1
Next
'文件上传结束
set file=nothing
set upload=nothing
if filename8848_1="" and filename8848_2="" then response.redirect "u_mod.asp?submitok=five"
END IF
END Sub