当前位置:编程学习 > asp >>

ASP程序求助:下面的代码是实现照片上传功能的,但是点上传按钮没有用,请高手帮忙!!

<!--#include file="sub/conn.asp"--> <!--#include file="sub/webvar.asp"--> <!--#include file="sub/fun.asp"--> <!--#include file="chkerr.asp"--> <%dim ifphoto if grade<=1 then set rs=Server.CreateObject("ADODB.recordset") rs.open"select count(id) from love_photo where userid="&userid&"",conn,1,1 ifphoto=rs(0) rs.close:set rs=nothing if ifphoto>3 then closeconn Call msg("Sorry!\n\n普通会员最多只能上传3张照片\n\n请到照片管理中心删除部分照片","-1") end if elseif grade=2 or grade=3 then set rs=Server.CreateObject("ADODB.recordset") rs.open"select count(id) from love_photo where userid="&userid&"",conn,1,1 ifphoto=rs(0) rs.close:set rs=nothing if ifphoto>30 then closeconn Call msg("Sorry!\n\n诚信会员、会长最多只能上传30张照片\n\n请到照片管理中心删除部分照片","-1") end if end if %> <!--#include file="sub/uploadinc2.0.asa"--> <!--#include file="sub/photo_picsize.asa"--> <% If Trim(request("Action"))="Upload" then Call UploadData() End If Sub UploadData() Dim upload Server.ScriptTimeOut=999999 set upload=new UpFile_Class ''建立上传对象 Dim ProductId,ClassId,ProductName,ProductSize,SmallPic,SmallPicSize,BigPic,BigPicSize,title,S_Height,S_Width S_Width=100 S_Height=125 Title=Replace(Replace(Replace(upload.form("Title"),"'",""),"<","<"),">",">") if Trim(Title)="" then closeconn:set upload=nothing Call msg("照片说明不能空白!请重试。","-1") end if '图片处理 dim file,fileExt,Filesize 'BigPic=UserID'用户ID BigPic=FormatDT(now(), 9)&cdstr(9) set file=upload.file("Pic") FileType=Ucase(file.FileType) fileExt=file.fileExt Filesize=file.FileSize If Filesize>0 then If instr(FileType,"JPEG")<=0 and instr(FileType,"GIF")<=0 Then set file=nothing:set upload=nothing:Closeconn Call msg("错误图片文件格式,必须是 jpg、gif。","-1") End If If Filesize>502400 Then set file=nothing:set upload=nothing:Closeconn Call msg("图片大小已经超出上传范围(500K)。","-1") Else
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,