文件上传时出现错误,提示一变量未定义,百看不解...请各位大虾帮忙!!

mapage 2003-10-07 11:39:46
调试时总提示第39行出错:
该变量未定义:upload_classes
我怎么也找不到解决的办法,请各位大虾帮忙???
这个文件的源代码如下:
<!-- #INCLUDE FILE="include/config.asp" -->
<!--#include file="include/upload_config.asp"-->
<!--#include file="include/conn.asp"-->
<script langiage='javascript' src='style/joekoe_config.js'></script>
<script langiage='javascript' src='style/mouse_on_title.js'></script>
<html>
<head>
<title><%response.write web_var(web_config,1)%> - 文件上传</title>
<meta http-equiv=Content-Type content=text/html; charset=gb2312>
<link rel=stylesheet href='images/joekoe.css' type=text/css>
</head>
<body topmargin=0 leftmargin=0 bgcolor=<%response.write web_var(web_color,1)%>>
<table border=0 height='100%'cellspacing=0 cellpadding=0><tr><td height='100%'>
<%
dim formname,upload_path,upload_type,upload_size,uup
uup="|article|down|forum|gallery|news|other|product|video|movie|website|"
action=trim(request.querystring("action"))
if var_null(login_username)="" or var_null(login_password)="" then
response.write " "&nologin_info
elseif post_chk()="no" then
response.write web_var(web_error,1)
else
upload_path=web_var(web_upload,1)
upload_type=web_var(web_upload,2)
upload_size=web_var(web_upload,3)
select case action
case "upfile"
call upload_chk()
case else
call upload_main()
end select
end if

call close_conn()

sub upload_chk()
Server.ScriptTimeOut=5000
dim upload,up_text,up_path,uptemp,uppath,up_name,MyFso,upfile,upcount,upfilename,upfile_name,upfile_name2,upfilesize,upid
set upload=new upload_classes
set MyFso=CreateObject("Scripting.FileSystemObject")
upcount=1
up_name=trim(upload.form("up_name"))
up_text=trim(upload.form("up_text"))
up_path=trim(upload.form("up_path"))
if int(instr(uup,"|"&up_path&"|"))=0 then up_path="other"
if len(up_path)<3 then up_path="other"
uppath=up_path
if right(upload_path,1)<>"/" then upload_path=upload_path&"/"
up_path=server.mappath(upload_path&up_path)
if not MyFso.folderExists(up_path) then
set up_path=MyFso.CreateFolder(up_path)
end if
if right(up_path,1)<>"/" then up_path=up_path&"/"
'if right(uppath,1)<>"/" then uppath=uppath&"/"

set upfile=upload.file("file_name1")
upfilesize=upfile.FileSize
upload_size=upload_size*1024
if upfilesize>0 then
upfilename=upfile.FileName
if upfilesize>upload_size then
uptemp="<font class=red_2>上传失败</font>:文件太大!(不能超过"&int(upload_size/1024)&"KB) "&go_back
else
upfile_name=Right(upfilename,(len(upfilename)-Instr(upfilename,".")))
upfile_name=lcase(upfile_name)
if instr(","&upload_type&",",","&upfile_name&",")>0 then
upfile_name2=upfile_name
upfile_name=up_name&"."&upfile_name
upfile.SaveAs up_path&upfile_name

sql="select id from upload where url='"&uppath&"/"&upfile_name&"'"
set rs=conn.execute(sql)
if rs.eof and rs.bof then
rs.close
sql="insert into upload(iid,nsort,types,username,url,genre,sizes,tim) " & _
"values(0,'',0,'"&login_username&"','"&uppath&"/"&upfile_name&"','"&upfile_name2&"',"&upfilesize&",'"&now_time&"')"
conn.execute(sql)
sql="select top 1 id from upload order by id desc"
set rs=conn.execute(sql)
upid=int(rs("id"))
else
conn.execute("update upload set username='"&login_username&"',sizes="&upfilesize&",tim='"&now_time&"' where id="&rs("id"))
end if
rs.close:set rs=nothing

uptemp="<font class=red>上传成功</font>:<a href='"&upload_path&uppath&"/"&upfile_name&"' target=_blank>"&upfile_name&"</a> ("&upfilesize&"Byte)"
if instr(up_text,"pic")>0 then
uptemp=uptemp&"<script>parent.document.all."&up_text&".value='"&uppath&"/"&upfile_name&"';"
else
uptemp=uptemp&"  [ <a href='?uppath="&uppath&"&upname=&uptext="&up_text&"'>点击继续上传</a> ]<script>parent.document.all."&up_text&".value+='"
select case lcase(upfile_name2)
case "gif","jpg","bmp","png"
uptemp=uptemp&"[IMG]"&upload_path&uppath&"/"&upfile_name&"[/IMG]"
case "swf"
uptemp=uptemp&"[FLASH="&web_var(web_num,9)&","&web_var(web_num,10)&"]"&upload_path&uppath&"/"&upfile_name&"[/FLASH]"
case else
uptemp=uptemp&"[DOWNLOAD]"&upload_path&uppath&"/"&upfile_name&"[/DOWNLOAD]"
end select
uptemp=uptemp&"\n';"
end if
if int(upid)>0 then uptemp=uptemp&"parent.document.all.upid.value+=',"&upid&"';"
uptemp=uptemp&"</script>"
else
uptemp="<font class=red_2>上传失败</font>:文件类型只能为:"&replace(upload_type,"|","、")&"等格式) "&go_back
end if
end if
else
uptemp="<font class=red_2>上传失败</font>:您可能没有选择想要上传的文件!"&go_back
end if
set upfile=nothing
response.write uptemp
set MyFso=nothing
set upload=nothing
end sub

sub upload_main()
dim uppath,upname,uptext
uppath=trim(request.querystring("uppath"))
upname=trim(request.querystring("upname"))
uptext=trim(request.querystring("uptext"))
if session("joekoe_online_admin")<>"joekoe_admin" and var_null(upname)<>"" then response.write "参数出错!":exit sub
if int(instr(uup,"|"&uppath&"|"))=0 then response.write "参数出错!":exit sub
if len(uppath)<1 or len(uptext)<1 then response.write "参数出错!":exit sub
if len(upname)<3 then upname=upname&upload_time(now_time)
%>
<table border=0 cellspacing=0 cellpadding=2>
<form name=form1 action='?action=upfile' method=post enctype='multipart/form-data'>
<input type=hidden name=up_path value='<%response.write uppath%>'>
<input type=hidden name=up_name value='<% response.write upname %>'>
<input type=hidden name=up_text value='<% response.write uptext %>'>
<tr>
<td><input type=file name=file_name1 value='' size=35></td>
<td align=center height=30><input type=submit name=submit value='点击上传'> (<=<% response.write upload_size %>KB)</td>
</tr>
</form>
</table>
<% end sub %>
</td></tr></table>
</body>
</html>
...全文
189 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
mapage 2003-10-07
  • 打赏
  • 举报
回复
第六部分:
'------------------------------------格式化分页-------------------------------------
sub format_pagecute()
if rssum mod nummer > 0 then
thepages=rssum\nummer+1
else
thepages=rssum\nummer
end if
page=trim(request("page"))
if not(isnumeric(page)) then page=1
if int(page)>int(thepages) or int(page)<1 then
viewpage=1
else
viewpage=int(page)
end if
end sub

'-------------------------------------栏目名称--------------------------------------
function format_menu(mvars)
dim i,mdim,mvar:mvar=trim(mvars):format_menu=""
mdim=split(web_menu,"|")
for i=0 to ubound(mdim)
if mvar=left(mdim(i),instr(mdim(i),":")-1) then format_menu=right(mdim(i),len(mdim(i))-instr(mdim(i),":")):exit for
next
erase mdim
end function

'-------------------------------------用户权限--------------------------------------
function format_user_power(uname,umode,pvar)
dim admint:admint=format_power2(1,1):format_user_power="yes"
if umode=admint then exit function
if instr("|"&pvar&"|","|"&uname&"|")<1 then format_user_power="no"
end function

'-------------------------------------页面权限--------------------------------------
function format_page_power(umode)
dim unum:unum=format_power(umode,2):format_page_power="yes"
if page_power="" then exit function
if instr("."&page_power&".","."&unum&".")<1 then format_page_power="no"
end function
mapage 2003-10-07
  • 打赏
  • 举报
回复
第五部分:
'------------------------------------格式化窗口2------------------------------------
function format_table(btype,tc)
'response.write tc
select case btype
case 1
format_table="<table border=1 width='98%' cellspacing=1 cellpadding=1 bgcolor="&web_var(web_color,tc)&" bordercolor="&web_var(web_color,1)&">"
case 2
format_table=""
case 3
format_table=" bgcolor="&web_var(web_color,tc)&" bordercolor="&web_var(web_color,tc)
case 4
format_table=" background='images/"&web_var(web_config,5)&"/bg_table.gif' bordercolor="&web_var(web_color,tc)
end select
end function

'------------------------------------格式化窗口3------------------------------------
function format_k(kvar,kt,kk,kw,kh)
dim temp1,t1
t1="images/"&web_var(web_config,5)&"/k"&kt&"_"
temp1=vbcrlf&"<table border=0 width="&kw+kk*2&" height="&kh+kk*2&" cellpadding=0 cellspacing=0>" & _
vbcrlf&"<tr>" & _
vbcrlf&"<td width="&kk&" height="&kk&"><img src='"&t1&"1.gif' border=0></td>" & _
vbcrlf&"<td width="&kw&" height="&kk&" background='"&t1&"top.gif'></td>" & _
vbcrlf&"<td width="&kk&" height="&kk&"><img src='"&t1&"2.gif' border=0></td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"<tr>" & _
vbcrlf&"<td width="&kk&" height="&kh&" background='"&t1&"left.gif'></td>" & _
vbcrlf&"<td width="&kw&" height="&kh&" align=center>"&kvar&"</td>" & _
vbcrlf&"<td width="&kk&" height="&kh&" background='"&t1&"right.gif'></td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"<tr>" & _
vbcrlf&"<td width="&kk&" height="&kk&"><img src='"&t1&"3.gif' border=0></td>" & _
vbcrlf&"<td width="&kw&" height="&kk&" background='"&t1&"end.gif'></td>" & _
vbcrlf&"<td width="&kk&" height="&kk&"><img src='"&t1&"4.gif' border=0></td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"</table>"
format_k=temp1
end function
mapage 2003-10-07
  • 打赏
  • 举报
回复
第四部分:
'------------------------------------case4-------------------------------------
case 4
format_bar=format_bar&" border=0>" & _
vbcrlf&"<tr><td height="&bar_height&" valign=bottom>"&bar_temp&"</td></tr><tr><td align=center>" & _
vbcrlf&"<table border=0 width='100%' cellspacing=0 cellpadding=0><tr align=center><td width=5 background='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_mbgl.gif'></td><td bgcolor="&web_var(bar_color,2)&">"&bar_body&"</td><td width=5 background='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_mbgr.gif'></td></tr></table></td></tr>"
if bar_mores="" then
format_bar=format_bar & "<tr><td align=center><table border=0 height=16 width='100%' cellspacing=0 cellpadding=0><tr align=center><td width=5><img border=0 src='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_bbgl.gif'></td>" & _
vbcrlf&"<td width='100%' background='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_bbgc.gif'></td><td width=78><img border=0 src='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_bbgr0.gif'></td></tr></table>"
else
format_bar=format_bar & "<tr><td align=center><table border=0 height=16 width='100%' cellspacing=0 cellpadding=0><tr align=center><td width=5><img border=0 src='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_bbgl.gif'></td>" & _
vbcrlf&"<td width='100%' background='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_bbgc.gif'></td><td width=78><img border=0 src='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_bbgr1.gif'></td></tr></table>"
end if
format_bar=format_bar &vbcrlf&"</td></tr></table>"
end select
end function
nchen123 2003-10-07
  • 打赏
  • 举报
回复
"但是在这个里面包含的一个文件:"include/upload_config.asp"是个空文件。"

----------------------------------------
我估计这个文件是定义上传类的,被你弄丢了
mapage 2003-10-07
  • 打赏
  • 举报
回复
第三部分:
'------------------------------------case3-------------------------------------
case 3
bar_temp=bar_temp&"><tr>" & _
vbcrlf&"<td width=20 valign=top>"&format_img("bar_"&bar_type&"_left.gif")&"</td>" & _
vbcrlf&"<td width="&web_var(bar_color,3)&" background='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_bg0.gif'>"&bar_vars&"</td>" & _
vbcrlf&"<td background='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_bg.gif' align=right> </td>" & _
vbcrlf&"<td width=20 align=right>"&format_img("bar_"&bar_type&"_right.gif")&"</td>"
end select
bar_temp=bar_temp&vbcrlf&"</tr></table>"
if bar_fk=1 or bar_fk=3 then
bar_body="<table border=0 width='98%' cellspacing=4 cellpadding=4><tr><td>"&bar_body&"</td></tr></table>"
else
bar_body="<table border=0 width='100%'><tr><td>"&bar_body&"</td></tr></table>"
end if

format_bar=kong&vbcrlf&"<table width='100%' cellspacing=0 cellpadding=0"
select case bar_fk
case 0,1
format_bar=format_bar&" border=0>" & _
vbcrlf&"<tr><td height="&bar_height&" valign=bottom"
if int(left(bar_type,1)) =0 then format_bar=format_bar&"bgcolor="&web_var(bar_color,1)
format_bar=format_bar&" background='"&web_var(bar_color,3)&"'>"&bar_temp&"</td></tr>" & _
vbcrlf&"<tr><td align=center"
if web_var(bar_color,2)<>"" then format_bar=format_bar&" bgcolor="&web_var(bar_color,2)
format_bar=format_bar&">"&bar_body&"</td></tr></table>"
case 2,3
if int(left(bar_type,1))=0 then
format_bar=format_bar&" border=1 bgcolor="&web_var(bar_color,2)&" bordercolor="&web_var(bar_color,1)&">" & _
vbcrlf&"<tr><td height="&bar_height&" bgcolor="&web_var(bar_color,1)&" background='"&web_var(bar_color,3)&"' valign=bottom>"&bar_temp&"</td></tr>" & _
vbcrlf&"<tr><td align=center bordercolor="&web_var(bar_color,2)&">"&bar_body&"</td></tr>"&vbcrlf&"</table>"
else
format_bar=format_bar&" border=0>" & _
vbcrlf&"<tr><td height="&bar_height&" valign=bottom>"&bar_temp&"</td></tr><tr><td align=center>" & _
vbcrlf&"<table border=0 width='100%' cellspacing=0 cellpadding=0><tr align=center><td width=1 bgcolor="&web_var(bar_color,1)&"></td><td bgcolor="&web_var(bar_color,2)&">"&bar_body&"</td><td width=1 bgcolor="&web_var(bar_color,1)&"></td></tr><tr><td height=1 colspan=3 bgcolor="&web_var(bar_color,1)&"></td></tr></table>" & _
vbcrlf&"</td></tr></table>"
end if
mapage 2003-10-07
  • 打赏
  • 举报
回复
第二部分:
'------------------------------------格式化窗口-------------------------------------
function format_bar(bar_var,bar_body,bar_type,bar_fk,bar_jt,bar_color,bar_more)
dim bar_temp,bar_vars,bar_mores,bar_height
bar_height=20:bar_mores=""
bar_vars="<table border=0 cellspacing=0 cellpadding=0><tr><td> "
if isnumeric(bar_jt) then
if bar_jt<>0 then bar_vars=bar_vars&"<img border=0 src='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_jt.gif' align=absmiddle> "
else
if bar_jt<>"" then bar_vars=bar_vars&img_small(bar_jt)
end if
bar_vars=bar_vars&bar_var&"</td></tr></table>"
if bar_more<>"" then bar_mores=bar_more&"  "

bar_temp=vbcrlf&"<table border=0 width='100%' cellspacing=0 cellpadding=0"
select case int(left(bar_type,1))
case 0
bar_temp=bar_temp&"><tr>" & _
vbcrlf&"<td>"&bar_vars&"</td>" & _
vbcrlf&"<td align=right>"&bar_mores&"</td>"
case 1
bar_temp=bar_temp&"><tr>" & _
vbcrlf&"<td width=20 valign=top>"&format_img("bar_"&bar_type&"_left.gif")&"</td>" & _
vbcrlf&"<td background='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_bg.gif'><table border=0 width='100%' cellspacing=0 cellpadding=0><tr><td>"&bar_vars&"</td><td align=right>"&bar_more&"</td></tr></table></td>" & _
vbcrlf&"<td width=20>"&format_img("bar_"&bar_type&"_right.gif")&"</td>"
case 2
bar_temp=bar_temp&"><tr>" & _
vbcrlf&"<td width=20 valign=top>"&format_img("bar_"&bar_type&"_left.gif")&"</td>" & _
vbcrlf&"<td width="&web_var(bar_color,3)&" background='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_bg0.gif'>"&bar_vars&"</td>" & _
vbcrlf&"<td width=20>"&format_img("bar_"&bar_type&"_center.gif")&"</td>" & _
vbcrlf&"<td background='images/"&web_var(web_config,5)&"/bar_"&bar_type&"_bg.gif' align=right> "&bar_more&"</td>" & _
vbcrlf&"<td width=20 align=right>"&format_img("bar_"&bar_type&"_right.gif")&"</td>"
mapage 2003-10-07
  • 打赏
  • 举报
回复
第一部分:
<%
Option Explicit
Response.buffer=true '开启缓冲页面功能
dim web_config,web_cookies,web_login,web_setup,web_menu,web_num,web_color,web_upload,web_safety,web_edition,web_label
dim web_news_art,web_down,web_movie,web_shop,web_stamp,space_mod
dim web_error,user_grade,user_power,forum_type,now_time,timer_start,redx,kong,ukong,go_back,closer,lefter,righter
dim login_username,login_password,login_mode,login_message,login_popedom,login_emoney
dim rs,sql,i,tit,tit_fir,index_url,action,page_power,m_unit
%>
<!-- #include file="common.asp" -->
<!-- #include file="functions.asp" -->
<%
space_mod=web_var(web_num,12):m_unit=web_var(web_config,8):now_time=time_type(now(),9):timer_start=timer()
web_label="<a href='http://jjb.skycodes.com' target=_blank><b><font face=Arial color=#CC3300>源码</font><font face=Arial>天空</font></b></a>"
redx=" <font color='#ff0000'>*</font> ":kong="<table width='100%' height=2><tr><td></td></tr></table>":web_edition="jjb.skycodes.com":ukong="<table border=0><tr><td height=6></td></tr></table>"
go_back="<a href='javascript:history.back(1)'>返回上一页</a>":closer="<a href='javascript:self.close()'>『关闭窗口』</a>"
login_mode="":login_popedom="":login_message=0
login_username=trim(request.cookies(web_cookies)("login_username"))
login_password=trim(request.cookies(web_cookies)("login_password"))
action=trim(request.querystring("action"))
DeltaCat 2003-10-07
  • 打赏
  • 举报
回复
那把 config.asp的代码帖出来
DeltaCat 2003-10-07
  • 打赏
  • 举报
回复
把你的 upload_config.asp的代码帖出来看看,是 文件上传类没定义,还是你的 类名写错了
mapage 2003-10-07
  • 打赏
  • 举报
回复
类都是在include/config.asp 和这个文件中定义的
nchen123 2003-10-07
  • 打赏
  • 举报
回复
你要把申明类的那个文件也包含进来才行。
mapage 2003-10-07
  • 打赏
  • 举报
回复
我看了,一点也找不到答案,帮我看看好吗 ?
但是在这个里面包含的一个文件:"include/upload_config.asp"是个空文件。
porlam 2003-10-07
  • 打赏
  • 举报
回复
首先检查一下你的所有变量在使用之前有没有定义,然后再检查一下你的语句的语法正不正确,有没有程序把参数当作变量的可能,特别注意标点符号,通常最容易出错误的地方在标点符号。
mapage 2003-10-07
  • 打赏
  • 举报
回复
没有。。。
要不要我把这几个文件也发给你看
nchen123 2003-10-07
  • 打赏
  • 举报
回复
你在 <!-- #INCLUDE FILE="include/config.asp" -->
<!--#include file="include/upload_config.asp"-->
<!--#include file="include/conn.asp"-->

这几个文件中有没有定义 upload_classes 这个类?
mapage 2003-10-07
  • 打赏
  • 举报
回复
各位大虾,由于很重要一个原因,所以想尽快找到答案!!

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧