<!--#include file="../inc/conn2.asp"-->
<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="eims.css">
</head><!--#include file="cookies.asp"-->
<!--#include file="../inc/UpLoad_Class.asp"-->
<style type="text/css">
<!--
body {margin-left: 0px; margin-top:1px;}
-->
</style>
<%

eType=trim(request("eType"))
fField=trim(request("fField"))

if request("Action")="exe" then

dim upload
set upload = new AnUpLoad

if request("eType")="pic" then
Upload.MaxSize=1024*picMax '设置最大上传限制,按字节计；默认为不限制
Upload.Exe=picType '设置合法扩展名,以|分割
else
Upload.MaxSize=1024*fileMax
Upload.Exe=fileType
end if

savey=year(now)
savem=month(now) : if len(savem)=1 then savem="0"&savem
savex=savey&savem
attached = SiteDir&"attached/"&savex '文件保存路径/年月保存

Upload.Charset="utf-8" '设置文本编码，默认为gb2312
Upload.openProcesser=false '禁止进度条功能，如果启用，需配合客户端

upload.GetData()
if upload.ErrorID>0 then 
	response.Write upload.Description
else
	dim file,savpath
	savepath = attached
	set file = upload.files("file1")
	if not(file is nothing) then
		result = file.saveToFile(savepath,0,true)
		if result then
			msg = attached&"/"&file.filename '文件名
			fileSize = int(file.size/1024) '大小
		else
			msg = file.Exception
		end if
	response.write "上传成功！文件大小："&fileSize&" KB <a href='?eType="&eType&"&fField="&fField&"'>[重新上传]</a>"
	else
	response.write "上传失败<a href='?eType="&eType&"&fField="&fField&"'>[重新上传]</a>"
	end if
end if
set upload = nothing
msg = replace(msg,"../attached/","attached/")
%>
<script language="javascript">window.parent.eForm.<%=fField%>.value="<%=msg%>"</script>
<%else%>
<form action="?Action=exe&eType=<%=eType%>&fField=<%=fField%>" method="post" enctype="multipart/form-data"> 
<input type="file" name="file1" />&nbsp;<input type="submit" value="上传" />
</form>
<%end if%>
