<!--#include file="../inc/Function.asp"-->
<!--#include file="upload_wj.inc"-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../css/style.css" rel="stylesheet" type="text/css">
<%
Call ChkLogin(session("WebAdminsUserName"))
set upload=new upload_file
fileType=upload.form("fileType")'获得允许上传的文件后缀名

if upload.form("act")="uploadfile" then
	filepath="../../UpLoadFiles/" & trim(upload.form("filepath"))
	for each formName in upload.File
		 set file=upload.File(formName)	
		 fileExt=lcase(file.FileExt)	'得到的文件扩展名不含有.
		 
		 if file.filesize<1 then'不能上传空文件
			response.write "<span style=""font-family: 宋体; font-size: 9pt"">空文件不能上传！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
			response.end
		 end if
		 if instr(fileType,fileExt)=0 then
			response.write "<span style=""font-family: 宋体; font-size: 9pt"">该文件类型不能上传！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
			response.end
		 end if
		
		 randomize
		 ranNum=int(900*rnd)+100
		 filename=Replace(Replace(Replace(now(),"-",""),":","")," ","") & ranNum &"."&fileExt
		 filename=Replace(filename,"/","")
		 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
			  file.SaveToFile Server.mappath(filepath&"/"&FileName)		
			  response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".value='"&FileName&"'</script>"	
		 end if
		 set file=nothing
	next
	set upload=nothing
end if
%>
<script language="javascript">
window.alert("文件上传成功!请不要修改生成的链接地址！");
window.close();
</script>


