请帮我看看这段ASP上传图片的代码哪有错?
<%ds="../../"%>
<!--#include file="../../conn/adminconn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<!--#include FILE="../../inc/load.inc"-->
<!--#include file="../checkvalid.asp" -->
<%
Response.Buffer = true
Response.ExpiresAbsolute=now()-1
Response.Expires=0
Response.CacheControl="no-cache"
%>
<%
if Not ChkPost then
response.redirect ("../..../admin/admin_login.asp")
response.end
end if
Dim objFSO
%>
<html>
<head>
<title>
<%=webname%>_上传图片
</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../css/style.css">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #f1f3f5;
}
-->
</style>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide
function killErrors() {
return true;
}
window.onerror = killErrors;
// -->
</SCRIPT>
<%
set fs=server.CreateObject("scripting.filesystemobject")
set upload=new upload_5xSoft ''建立上传对象
'--------将日期转化成文件名--------
formPath="../../upimages/"
aformPath="newsuppic/"
''在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
if right(aformPath,1)<>"/" then aformPath=aformPath&"/"
set file=upload.file("picture") ''生成一个文件对象
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
if file.filesize>200000 then
response.write"<SCRIPT language=JavaScript>alert('上传图片大于规定(200K),请改变文件大小后重新上传!');"
response.write"javascript:history.back(-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
response.write"<SCRIPT language=JavaScript>alert('上传图片只支持 gif|jpg|jpeg|bmp|png 图象文件!');"
response.write"javascript:history.back(-1)</SCRIPT>"
response.end
end if
thename=aformPath&MakedownName()&"."&FileExt
file2=server.MapPath(file2)
if fs.FileExists(file2) then
fs.DeleteFile file2,true
end if
'开始判断会员图片目录是否存在
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(Server.MapPath(""&formPath&""&aformPath&"")) Then'如果存在就直接保存图片
file.SaveAs Server.mappath(formPath&thename)
Else
objFSO.CreateFolder(Server.MapPath(""&formPath&""&aformPath&""))'不存在就建一个目录
file.SaveAs Server.mappath(formPath&thename)
End If
Set objFSO = Nothing '释放 FileSystemObject 对象实例内存空间
imgs=thename
else
response.write"<SCRIPT language=JavaScript>alert('上传图片为空或图片太大!');"
response.write"javascript:history.back(-1)</SCRIPT>"
response.end
end if
response.write"<font color=""red"">上传标题图片成功</font>"
%>
<script>
parent.document.form.picture.value="<%=imgs%>";
</script>
</html>