<!--#include file="upload_snsn.inc"-->
<%
set upload=new upload_file
if upload.form("act")="uploadfile" then
	filepath=trim(upload.form("filepath"))
	filelx=trim(upload.form("filelx"))
	
	i=0
	for each formName in upload.File
		set file=upload.File(formName)
		fileExt=lcase(file.FileExt)	'得到的文件扩展名不含有.
		if file.filesize<10 then
			response.write "<span style=""font-family: 宋体; font-size: 9pt"">请先选择你要上传的文件！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
			response.end
		end if
		if filelx="1" then
			if fileext<>"gif" and fileext<>"jpg"  then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传jpg或gif格式的图片！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if
			if file.filesize>(300*1024) then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 300K 的图片文件！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if
		end if
		if filelx="2" then
			if fileext<>"gif" and fileext<>"jpg" and fileext<>"swf"  then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传jpg、gif格式的图片或swf格式的Flash文件！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if
			if file.filesize>(300*1024) and fileext<>"swf" then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 300K 的图片文件！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if
			if file.filesize>(3000*1024) and fileext="swf" then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 3M 的Flash文件！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if
		end if
		if filelx="3" then
			if fileext<>"htm"  then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传htm格式的网页文件！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if
			if file.filesize>(300*1024) then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 300K 的网页文件！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if
		end if
		randomize
		ranNum=int(90000*rnd)+10000
		filename1=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
		filename=adminn&filepath&filename1
		
		if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
			'file.SaveAs Server.mappath(filename)   ''保存文件
			file.SaveToFile Server.mappath(FileName)
			if trim(upload.form("FormName"))="" then
%>
<html>
<head>
<title>上传文件成功</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body >
<center>
<div style="width:400px;margin-top:10px;padding:3px 0;text-align:center;font-size:12px;color:#cccccc;border:solid 1px;border-color:#cccccc #cccccc #cccccc;background:#cccccc">上传结果报告</div>
<div style="width:400px;padding:20px;font-size:12px;color:#cccccc;border:solid 1px;border-color:#cccccc #cccccc #cccccc;">
<%
				response.write file.FileName&"　　上传成功!　　<br>"
				response.write "新文件名："&FileName1&"<br>"
				response.write "请将你网页上的原图片文件名改为上传后的新文件名！<br>"
%>
<input type='button' style='width:65px;height:20px;font-size:12px' value='关闭' onclick='window.close()'></div>
<div style='width:400px;padding:3px 0;font-size:12px;color:#cccccc;border:solid 1px;border-color:#cccccc #cccccc #cccccc;background:#cccccc;'></div>
</center>
</body>
</html>
<%
			else
				response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".value='"&FileName&"'</script>"
%>
<script language="javascript">
window.alert("文件上传成功!请不要修改生成的链接地址！");
window.close();
</script>
<%
			end if
		end if
		set file=nothing
	next
	set upload=nothing
end if
%>
