图片上传,为什么总提示“发生意外”
<!--#include file="conn.asp"-->
<!--#include file="upload_object.asp"-->
<!--#include file="ubb.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
uname=session("user_name")
pname=session("photo_name")
set upload=new upload_5xSoft
dim str,rs,p,ph,pi,path,path1,path2
p=upload.form("pname")
ph=upload.form("phname")
pi=upload.form("pintro")
str="select * from photopath where user_name='"&uname&"' and photo_name='"&pname&"'order by id desc"
set rs=db.execute(str)
fold_tmp=cstr(date())
set fd=Createobject("Scripting.FileSystemObject")
fs=fd.FolderExists(server.mappath("photo"&"/"&rs("user_name")&"/"&rs("photo_name")&"/"& fold_tmp))
if not(fs) then
fd.CreateFolder server.mappath("photo"&"/"&rs("user_name")&"/"&rs("photo_name")&"/"& fold_tmp)
end if
set fd=nothing
formPath="photo"&"/"&rs("user_name")&"/"&rs("photo_name")&"/"& fold_tmp & "/" '图片上传路径
for each formName in upload.file '列出所有上传了的文件
set file=upload.file(formName) '生成一个文件对象
if file.filesize > 2000000 then
response.write "<script>alert(""对不起,图片大小应小于200K!"");history.go(-1);</script>"
response.end
end if
if file.filesize > 0 and file.filesize < 2000000 then
fileExt=lcase(right(file.filename,4)) '取得文件扩展名
filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&file.FileName
img="photo"&"/"&rs("user_name")&"/"&rs("photo_name")&"/" & fold_tmp & "/"&filename
if fileEXT <> ".gif" and fileEXT <> ".jpg" and fileEXT <> ".bmp" and fileEXT <> ".rar" and fileEXT <> ".doc"and fileEXT <> ".txt" and fileEXT <> ".swf" then
response.write "<p align='center'><br><br><br><br><br><font size=2>错误提示:文件格式不对 [ <a href=# onclick=history.go(-1) style='color:red'>重新上传</a> ]</font></p>"
response.end
else
file.SaveAs Server.mappath(formPath&filename)
if filename = "" then
fold_tmp = ""
end if
if filename <> "" and fold_tmp <> "" then
str="insert into pic(user_name,photo_name,pic_name,pic,pic_intro,submit_date) values('"&uname&"','"&ph&"','"&p&"','"&img&"','"&pi&"','"&date&"')"
db.execute(str)
end if
end if
end if
set file=nothing
next
set upload=nothing
response.Redirect"upload.asp"
%>
</body>
</html>
为什么红色部分老提示发生意外呢?