<!--#include file="../CheckAdmin.Asp"-->
<!--#Include File="Cls_Upload.asp"--><%
'==========================================
'文 件 名：XlsUpLoad.asp
'文件用途：文件上传
'==========================================

'判断权限

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>上传XLS文件</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
body {
	margin-left: 0px;
	margin-top: 8px;
	margin-right: 0px;
	margin-bottom: 0px;
}
a {
	font-size: 12px;
	color: #000;
}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000;
}
a:hover {
	text-decoration: none;
	color: #333;
}
a:active {
	text-decoration: none;
	color: #000;
}
.Input,.Button {
	height:20px;
	line-height:20px;
	border:1px solid #999;
	border-bottom:1px solid #CCC;
	border-right:1px solid #CCC;
}
.Button {
	margin-left:0;
}
-->
</style></head>
<body>
<%
Call UpPic()

'==============================
'函 数 名：UpPic
'作    用：上传图片
'参    数：
'==============================
Sub UpPic()
	If Request.QueryString("Submit")="Pic" Then
		Dim UploadPath,UploadPath2,UploadSize,UploadType,UpRequest,AutoSave,Size,ShowSize,Str
		UploadPath="../uploadfile/"
		UploadPath2="../uploadfile/"
		UploadSize="10240"
		UploadType="csv" '或xls
		Set UpRequest=New UpLoadClass
		UpRequest.SavePath=UploadPath
		UpRequest.MaxSize=UploadSize*1024 
		UpRequest.FileType=UploadType
		AutoSave=true
		UpRequest.Open
		If UpRequest.Form("file_Err")<>0  Then
			Select Case UpRequest.Form("file_Err")
				Case 1:Str="<div style=""padding-top:5px;padding-bottom:5px;""> <font color=blue>上传不成功!文件超过"&UploadSize&"k [<a href='javascript:history.go(-1)'>重新上传</a>]</font></div>"
				Case 2:Str="<div style=""padding-top:5px;padding-bottom:5px;""> <font color=blue>上传不成功!文件格式不对 [<a href='javascript:history.go(-1)']>重新上传</a>]</font></div>"
				Case 3:Str="<div style=""padding-top:5px;padding-bottom:5px;""> <font color=blue>上传不成功!文件太大且格式不对 [<a href='javascript:history.go(-1)'>重新上传</a>]</font></div>"
			End Select
			Response.Write Str
		Else
			Response.Write "<script language=""javascript"">parent."&Request.QueryString("Form")&"."&Request.QueryString("Input")&".value='"&UploadPath2&UpRequest.Form("File")&"';" 
			Response.Write "</script>"
			Size=UpRequest.Form("file_size")
			ShowSize=Size & " Byte"   
			If Size>1024 Then  
				Size=(Size\1024)  
				ShowSize=Size & " KB"  
			End If  
			If Size>1024 Then  
				Size=(Size/1024)  
				ShowSize=FormatNumber(Size,2) & " MB"		  
			End If 
			Response.Write "<div style=""padding-top:5px;padding-bottom:5px;""> <font color=red>文件上传成功</font> [<a href='javascript:history.go(-1)'>重新上传</a>]</div>"
		End If
		Set UpRequest=nothing
	End If
	Response.Write "<Form name=Form action='?Submit=Pic&Form="&Request.QueryString("Form")&"&Input="&Request.QueryString("Input")&"' method=post enctype=multipart/Form-data>"
	Response.Write "<input type='file' name='file' class='Input' Size='20'>&nbsp;"
	Response.Write "<input type='submit' name='submit' value='上传' class=""Button"">"
	Response.Write "</Form>"
End sub
%>
</body>
</html>