急等:::请问各位高手一个关于上传图片的问题,
我有一段程序:
<!--#include file="../../conn/dbconn2.asp"-->
<!--#include file="../../inc/safe.asp"-->
<%
Response.Buffer = true
Response.ExpiresAbsolute=now()-1
Response.Expires=0
Response.CacheControl="no-cache"
%>
<%
if Not ChkPost then
response.redirect ("../../login/chklogin.asp?login=4")
response.end
end if
if session("flag")<>1 then
response.Redirect("../../login/vip.asp")
response.end
end if
%>
<%
if Chkrequest(request("id")) then
id=request("id")
else
Response.Redirect ("../../login/chklogin.asp?login=4")
end if
'cimg=request("cimg")
set conn=openDB() '链接数据库
set rs=server.createobject("adodb.recordset")
sql="select cimg from corporation where id="&id
rs.open sql,conn,1,3
file2=rs("cimg")
set fs=server.CreateObject("scripting.filesystemobject")
%>
<!--#include FILE="upload.inc"-->
<%
set upload=new upload_5xSoft ''建立上传对象
'--------将日期转化成文件名--------
formPath="pic/"
set file=upload.file("cimg") ''生成一个文件对象
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
if file.filesize>200000 then
response.write"<SCRIPT language=JavaScript>alert('您上传的图片大于规定大小(200K),请改变文件大小后再进行上传。');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
FileExt = Mid(file.Filename, InStrRev(file.Filename, ".")+1)
FileExt = FixName(FileExt)
If Not ( CheckFileExt(FileExt) and CheckFileType(File.FileType) ) Then
'if trim(right(file.FileName,3))<>"jpg" and trim(right(file.FileName,3))<>"gif" then
response.write"<SCRIPT language=JavaScript>alert('您上传的文件必须是gif|jpg|jpeg|bmp|png图象文件,请将你上传的文件转换为以上格式后再进行上传。');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
thename=session("id")&MakedownName()&"."&FileExt
file2=server.MapPath(file2)
if fs.FileExists(file2) then
fs.DeleteFile file2,true
end if
'thename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&right(file.filename,4)
'file.filename=thename
file.SaveAs Server.mappath(formPath&thename)
imgs=thename
else
response.write"<SCRIPT language=JavaScript>alert('未此到该图片或该图片为零字节!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
rs("cimg")="pic/"&imgs
rs.Update
rs.close
Set rs=nothing
Conn.Close
Set Conn=nothing
%>。。。。
但当我执行这个页面时出现下面的错误:
Microsoft VBScript 运行时错误 错误 '800a000d'
类型不匹配: 'Server.MapPath'
/member/corporation/cimg_save.asp,行59
请帮我解决下,好吗?