<%@ Control Language="c#" AutoEventWireup="false" Codebehind="UploadSingle.ascx.cs" Inherits="WebUI.MMS.UploadSingle" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>
单文件上传
</title>
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<style media="all" type="text/css">
body {background-color: #D3E5FA;}
td, span, legend {font: icon;}
fieldset {border: 1px solid #A1C3ED;}
legend {color: #2E74CF;font-weight: bold;}
#loader, #message {color: red;}
.flatTextBox {border: 1px solid #2E74CF;}
.headerText {cursor:default;overflow: hidden;color: #FFFFFF;font-weight: bold;filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=1, OffY=1, Color='#000000', Positive='true');}
button, button.disabled {background-color: transparent;border: none;width: 87px;height: 22px;}
button {background-image: url(../Image/buttonTemplate.gif);}
button.disabled {background-image: url(../Image/buttonTemplateDisabled.gif);}
button table tr td, button.disabled table tr td {font-weight: bold;text-align: center;vertical-align: middle;padding-bottom: 2px;}
button table tr td {color: #FFFFFF;filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=1, OffY=1, Color='#000000', Positive='true');}
button.disabled table tr td {filter: ;}
.button {
	BORDER-RIGHT: 1px outset; PADDING-RIGHT: 1px; BORDER-TOP: 1px outset; PADDING-LEFT: 1px; FONT-SIZE: 12px; PADDING-BOTTOM: 1px; BORDER-LEFT: 1px outset; PADDING-TOP: 2px; BORDER-BOTTOM: 1px outset; FONT-FAMILY: "宋体"; HEIGHT: 20px; BACKGROUND-COLOR: #c1d7f4
}
</style>
<script language="javascript" type="text/javascript">
<!--
//功能：单文件上传
//名称：SingleUpload
//======================================
var Source = "<%= Request.QueryString["allowType"]%>";

function checkStr(str)
{
	if(Source == "" || Source == null)
		return true;
	else
	{
		var ss = Source.split(",");
		var allow = false;
		for(var i = 0; i < ss.length; i++)
		{
			//alert(ss[i]);
			if(str == ss[i]){allow = true;}
		}
		return allow;
	}
}


//验证是否符合指定的上传格式
function checkData()
{
	var str = document.forms[0]._ctl0_File1.value;

	if(str == null || str == "")
	{
		alert("请从“浏览”选择文件");
		return false;
	}
	else
	{
		var extName = str.split(".")
		var ext = extName[extName.length-1];
		ext = ext.toLowerCase();
		if(!checkStr(ext))
		{
			alert("提示： "+ext+" 格式的文件不能上传！\t\t\t\n\n只允许以下格式的文件：\n\n\t"+Source);
			return false;
		}
	}
}

window.onload = function()
{
	if(parent.checkURL != null)
	{
		parent.checkURL();
	}
}

function returnPage()
{
	location.href = location.href;
}
//-->
</script>
</HEAD>
<BODY>
	<asp:Panel ID="uploadPanel" Runat="server">
	<INPUT type="file" id="File1" class="flatTextBox" size="24" runat="server">
		<INPUT id="Submit1" type="submit" value="上 传" name="Submit1" onclick="return checkData();" class="button" runat="server">
	</asp:Panel>
	<asp:Panel ID="resultPanel" Runat="server">
		<asp:Label ID="label" Runat="server"></asp:Label> &nbsp;&nbsp <a href="javascript:returnPage();">返 回</a>
	</asp:Panel>
</BODY>
</HTML>
