当前位置:编程学习 > C#/ASP.NET >>

求助我的网站上传照片就出错~在线等!

这个是我的上传源码
<!--#include file="conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="inc/chkinput.asp" -->
<%

dim picid,classname
dim currentPage,totalrec,Pcount,page_count,endpage
dim abgcolor
dim PhotoPath,MaxPhotoSize,FormName,picinfo,picset,classid,fileExt,path,datetime,ranNum
dim filename

stats="上传照片"
if not founduser then
   errmsg=errmsg+"<br>"+"<li>您没有<a href=login.asp target=_blank>登录</a>。"
founderr=true
end if
if Cint(GroupSetting(19))=1 then
Errmsg=Errmsg+"<br>"+"<li>您没有上传照片的权限,请<a href=login.asp>登陆</a>或者同管理员联系。"
founderr=true
end if

PhotoPath=""&txl_info(12)&""
MaxPhotoSize=""&txl_set(23)&""

if founderr then
call head()
call head_var("错误信息",Request.ServerVariables("HTTP_REFERER"))
call txl_error()
else
call head()
call head_var("班级相册","p_index.asp")
if founderr then
call txl_error()
else
if request("action")="upload" then
call uploadphoto()
else
call upform()
end if
if founderr then call txl_error()
end if
end if
call foot()

sub upform()
abgcolor="tablebody2"
%>
<!--#INCLUDE FILE="inc/sendnow.inc" -->
<div id="sponsorAdDiv" style="visibility:hidden">
<table width="400" height="50" bgcolor="#ce0000" border=0 cellspacing=1>
<tr>
<td align=center>
<table width="100%" height="100%"  border=0 cellspacing=0>
<tr>
<td class=tablebody1 align=center><font color=#ff0000>正在上传图片,请稍候......</font></td>
</tr>
</table>
</td>
</tr>
</table>
</div>

<table width="<%=txl_body(0)%>" cellpadding="0" cellspacing="0" align="center" style="border:1px <%=txl_body(9)%> solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 1px;">  
<tr> 
<td width=120 bgcolor=<%=txl_body(10)%> align="center" valign="top">
<br>
<a href=p_send.asp><img src="<%=txl_info(6)&txl_skinpic(10)%>"  height="25" border=0></a> <br><br>
<a href=p_my.asp><img src="<%=txl_info(6)&txl_skinpic(11)%>"  height="25" border=0></a> <br><br>
<a href=p_order.asp><img src="<%=txl_info(6)&txl_skinpic(12)%>"  height="25" border=0></a><br><br><br>
<%
set rs=server.createobject("adodb.recordset")
sql="select classid,classname,classinfo from mc_imgclass order by classid"
rs.open sql,conn,1
if rs.eof and rs.bof then
response.write "<p>还没有设定班级照片类别</p>"
else
do while not rs.eof
response.write "<a href=""p_more.asp?classid="&rs("classid")&""" title="""&rs("classinfo")&"""><img src="""&txl_info(7)&"dot02.gif"" border=0> "&rs("classname")&"</a><br><br>"
rs.movenext
loop
end if
%>
</td>
<td width=* valign="top"><br>
<table width="95%" cellpadding="5" cellspacing="1"  class=tableborder1>
<form name="frmupload" action="p_send.asp?action=upload" method="post"  enctype="multipart/form-data" onsubmit="submitonce(this);initAd();">
<tr>
<th height=25 colspan=2>上 传 照 片</th>                
</tr>
<tr>
<td class=tablebody1 height="25" colspan=2>
<table width=100% border=0 cellspacing=6 cellpadding=6>
<tr>
<td><SPAN style="FONT-SIZE: 9pt; line-height: 150%;"><b>注意事项:</b><BR>1、请不要在此发布不健康、不文明的有害信息,一经发现,立即删除!<BR>2、请尽量上传与班级有关的照片,且注意上传照片的分类。<BR>3、仅接受.jpg                 
                                  和.gif格式的图片,且文件名必须以<font color=<%=txl_body(20)%>>.jpg</font>或<font color=<%=txl_body(20)%>>.gif</font>为后缀。<br>4、上传照片的宽度和高度不要过大,最佳效果为:<font color=<%=txl_body(20)%>>500 * 600</font>,大小不超过<font color=<%=txl_body(20)%>><%=MaxPhotoSize/1024%>K</font>字节。<BR>5、照片默认为“完全可见”,如果选择“成员可见”,将只有班级成员才能看到。</SPAN></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class=tablebody2 height="25" align=right><b>用 户 名 </b></td>                
<td class=tablebody1>  <input name=realname value=<%=membername%>></td>               
</tr>
<tr>
<td class=tablebody2 height="25" align=right><b>照片类型 </b></td>
<td class=tablebody1>  <select name=classid>
<option value="" selected> 请选择类型 </option>
<%
set rs=server.createobject("adodb.recordset")
sql="select classid,classname,classinfo from mc_imgclass order by classid"
rs.open sql,conn,1
if rs.eof and rs.bof then
response.write "<p>还没有设定班级照片类别</p>"
else
do while not rs.eof
response.write "<option value="""&rs("classid")&""">** "&rs("classname")&" **</option>"
rs.movenext
loop
end if
%>
</select><font color=#ff0000> * </font>注意照片类型!</td>
</tr>
<tr>
<td class=tablebody2 height="25" align=right><b>照片设定 </b></td>
<td class=tablebody1>  <input type=radio name=picset value="0" checked> 完全可见 <input type=radio name=picset value="1">成员可见</td>                
</tr>
<tr>
<td class=tablebody2 height="25" align=right><b>照片说明 </b></td>
<td class=tablebody1>  <input size="50" name="picinfo" maxlength=30><font color=#ff0000> * </font>请不要超过50个字符!</td>
</tr>
<tr>
<td class=tablebody2 height="25" align=right><b>照片位置 </b></td>
<td class=tablebody1>  <INPUT type=file size=30 name=UpFile><input type=hidden name=test value=test></td>
</tr>
<tr>
<td class=tablebody1 height=50 colspan=2 align=center>如果你的图片文件较大或网络速度太慢,上载过程可能要一段时间,请耐心等待!</td>
</tr>
<tr>
<td height="30" class=tablebody2 align="center" colspan=2><input  type="submit" value="开始上载" name="upsubmit"></td>
</tr>
</form>
</table>
<br>
</td>
</tr>
</table>
<%
end sub

sub uploadphoto()
dim upload,file
Dim fso
%>
<!--#INCLUDE FILE="inc/upload.inc" -->
<%
set upload=new upload_5xSoft

picinfo=upload.form("picinfo")
if picinfo="" then
Errmsg=Errmsg+"<br>"+"<li>请输入图片说明."
founderr=true
elseif strLength(picinfo)>50 then
foundErr=True
ErrMsg=ErrMsg+"<Br>"+"<li>主题长度不能超过50"
else
picinfo=trim(upload.form("picinfo"))
end if

classid=upload.form("classid")
if classid="" then
foundErr=true
Errmsg=Errmsg+"<br>"+"<li>请选择照片的类型。"
elseif not isInteger(classid) then
foundErr=true
Errmsg=Errmsg+"<br>"+"<li>请选择照片的类型。"
else
classid=upload.form("classid")
end if
picset=upload.form("picset")

'response.write pictype
'response.end
set file=upload.file("UpFile") 

fileExt=lcase(right(file.filename,4))
if file.filesize<100 then
Errmsg=Errmsg+"<br>"+"<li>请先选择你要上传的文件."
founderr=true
elseif fileEXT<>".gif" and fileEXT<>".jpg" then
Errmsg=Errmsg+"<br>"+"<li>所要上传文件的格式错误!."
founderr=true
elseif int(file.filesize)>int(MaxPhotoSize) then
  Errmsg=Errmsg+"<br>"+"<li>文件大小超过了"&MaxPhotoSize/1024&"K限制."
founderr=true
end if 

if founderr then
stats="错误信息"
call head()
call head_var("","")
call txl_error()
response.end
end if

if right(PhotoPath,1)<>"/" then 
PhotoPath=PhotoPath&"/" 
end if

randomize
ranNum=int(90000*rnd)+10000
datetime=year(date)&month(date)&day(date)&hour(now)&minute(now)&second(now)
filename=datetime&ranNum&fileExt
file.SaveAs Server.mappath(PhotoPath&FileName)


Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "mc_imgdata",conn,1,3
rs.addnew
rs("filename")=filename
rs("filesize")=file.filesize
rs("classid")=classid
rs("addtime")=now()
rs("postuser")=membername
rs("postuserid")=userid
rs("picinfo")=picinfo
rs("picset")=picset
rs.update
rs.close

conn.execute("update mc_config set PhotoNum=PhotoNum+1")
sql = "update [mc_classuser] set photocount=photocount+1,points=points+"&txl_user(8)&" where userid="&userid
conn.execute(sql)
sucmsg=sucmsg+"<br>"+"<li>您的照片已经成功上载,并收藏在您的班级相册中!"
call txl_suc()
set file=nothing
set upload=nothing 
end sub
%>

大家帮忙看看哪里的毛病 谢谢 --------------------编程问答-------------------- 大家帮帮忙
--------------------编程问答-------------------- 你也不说出什么错.
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,