asp上传图片程序
ifRequest("action")="ok"thenDIMUPLOADformPath="UpLoad/"SETUPLOAD=NEWUPLOAD_5XSOFTsetf...
if Request("action")="ok" then
DIM UPLOAD
formPath="UpLoad/"
SET UPLOAD=NEW UPLOAD_5XSOFT
set file=UPLOAD.file("p0")
if file.filesize>100 and file.filesize>10000000 then
call showerr("您所上传的图片超过了1024KB,请重新上传!")
end if
' if file.filesize>100 and file.filesize<10000000 then
fileExt=lcase(right(file.filename,4))
randomize
ranNum=int(90000*rnd)+10000
filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&fileExt
file.SaveAs Server.mappath(filename)
set rs=server.createobject("adodb.recordset")
sql="select * from Vote where id="&UPLOAD.FORM("voteid")
rs2=conn.execute(sql)
if rs2("p0")<>null or rs2("p0")<>"" then
CALL DoDelFile(RS2("p0"))
end if
rs.open "select * from Vote where id="&UPLOAD.FORM("voteid"),conn,1,3
rs.addnew
rs("p0")=filename
rs.update
rs.close
set rs=nothing
call showmsg("照片更新成功!","View.asp?id="&UPLOAD.FORM("voteid"))
' end if
end if
这段程序,怎么上传后数据库的文件名没有后缀,文件夹里也没有相应的图片 展开
DIM UPLOAD
formPath="UpLoad/"
SET UPLOAD=NEW UPLOAD_5XSOFT
set file=UPLOAD.file("p0")
if file.filesize>100 and file.filesize>10000000 then
call showerr("您所上传的图片超过了1024KB,请重新上传!")
end if
' if file.filesize>100 and file.filesize<10000000 then
fileExt=lcase(right(file.filename,4))
randomize
ranNum=int(90000*rnd)+10000
filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&fileExt
file.SaveAs Server.mappath(filename)
set rs=server.createobject("adodb.recordset")
sql="select * from Vote where id="&UPLOAD.FORM("voteid")
rs2=conn.execute(sql)
if rs2("p0")<>null or rs2("p0")<>"" then
CALL DoDelFile(RS2("p0"))
end if
rs.open "select * from Vote where id="&UPLOAD.FORM("voteid"),conn,1,3
rs.addnew
rs("p0")=filename
rs.update
rs.close
set rs=nothing
call showmsg("照片更新成功!","View.asp?id="&UPLOAD.FORM("voteid"))
' end if
end if
这段程序,怎么上传后数据库的文件名没有后缀,文件夹里也没有相应的图片 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询