<%@ Page Language="C#" AutoEventWireup="true" Inherits="PowerEasy.Module.General.WebSite.Admin.Accessories.FileUpload"
    CodeBehind="FileUpload.aspx.cs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>上传文件</title>
</head>

<script type="text/javascript" src="<%= ResolveClientUrl("~/JS/Silverlight.js")%>"></script>

<script type="text/javascript">
    function onSilverlightError(sender, args) {
        document.getElementById("Upload").style.display = "";
        document.getElementById("silverlightControlHost").style.display = "none";
        document.getElementById("errorLocation").innerHTML = "很抱歉，使用Silverlight上传的时候出错，请使用普通方式上传。";
    }
    function CheckSilverLight() {
        if (Silverlight.isInstalled(null)) {
            document.getElementById("Upload").style.display = "none";
            document.getElementById("silverlightControlHost").style.display = "";
        }
    }
</script>

<body class="tdbg">
    <form id="form1" runat="server" enctype="multipart/form-data">
    <table cellpadding="0" cellspacing="0" border="0" style="height: 100%; width: 100%"
        id="Upload">
        <tr class="tdbg">
            <td valign="top">
                <asp:FileUpload ID="FupFile" runat="server" /><asp:Button ID="BtnUpload" runat="server"
                    CssClass="inputbutton" Text="上传" OnClick="BtnUpload_Click" /><pe:RequiredFieldValidator
                        ID="ValFile" ShowRequiredText="false" runat="server" ErrorMessage="请选择上传路径" ControlToValidate="FupFile"></pe:RequiredFieldValidator><asp:Label
                            ID="LblMessage" runat="server" ForeColor="red" Text=""></asp:Label>
            </td>
        </tr>
    </table>
    <div id='errorLocation' style="font-size: small; color: Gray;">
    </div>
    <div id="silverlightControlHost" class="tdbg" style="display: none;">
        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
            width="100%" height="100" class="tdbg">
            <param name="source" value="<%= ResolveClientUrl("~/ClientBin/FileUpLoad.zip")%>" />
            <param name="onerror" value="onSilverlightError" />
            <param name="background" value="Transparent" />
            <param name="wmode" value="Transparent" />
            <param name="windowless" value="true" />
            <param name="wmode" value="Transparent" />
            <param name="minRuntimeVersion" value="2.0.31005.0" />
            <param name="autoUpgrade" value="true" />
            <param name="initParams" value="UploadHandlerName=<%= Page.Request.Url.Scheme + "://" + Page.Request.Url.Authority + BasePath + (IsAdminManage?"Admin":"User") %>/Accessories/HttpUploadHandler.ashx,EnableUploadFiles=<%=EnableUploadFiles%>,CustomParam=<%=CustomParam%>,FileFilter=文件(<%=FileExtArr%>)|<%=FileExtArr%>,ReturnJSFunction=<%=ReturnJSFunction%>,CustomReturnJSFunction=<%=CustomReturnJSFunction %>" />
            <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: underline;">
                你可以点此安装SilverLight以获得更好的上传体验 </a>
        </object>
        <iframe style='visibility: hidden; height: 0; width: 0; border: 0px'></iframe>
    </div>
    </form>
</body>
</html>
