<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UploadFileByCode.aspx.cs"
    Inherits="Webdisk.UploadFileByCode" %>

<%@ Register TagPrefix="uc" TagName="uc1" Src="~/Top.ascx" %>
<%@ Register TagPrefix="uc" TagName="uc2" Src="bottom.ascx" %>
<!DOCTYPE html>
<html >
<head runat="server">
    <link href="css/common.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="js/artDialog/css/ui-dialog.css" />

    <script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="js/artDialog/dist/dialog-plus.js" type="text/javascript"></script>
    <title>上传文件(上传码)</title>
</head>
<body>
    <!-- Header Start -->
        <uc:uc1 ID="top" runat="server" />
    <!-- Header End -->
    <!-- Content Start -->
    <form id="Form1" runat="server">
    <div class="content">
        <div class="block01 mt30">
            <div class="upload">
                <ul>
                    <li>
                        <h2>
                            上传文件</h2>
                    </li>
                    <li>
                    <input class="input_1" id="txtCode" type="text"  runat="server"/><input class="but_1" value="上传文件" name=""
                            type="button"  runat="server" onclick="submitCode()" id="btnUploadFile" />
                            <a runat="server" id="newWindow" target="_blank" href=""></a>
                </ul>
                <p>
                    <img src="images/img_01.png" /></p>
            </div>
        </div>
    </div>
    </form>
    <!-- Content End -->
    <!-- Footer Start -->
            <uc:uc2 ID="bootom" runat="server" />
    <!-- Footer End -->
</body>
</html>

<script language="javascript" type="text/javascript">
    setHeadMenu(5);
	var iframeDialog = null ;
	function submitCode(){
		var code = $.trim($("#txtCode").val());
        if (code == "" ) {
            alert("请输入你获取的上传码！");
            return false;
        }
		$.ajax({
			url : "OtherHandler.ashx?cmd=ExistUploadCode&code="+encodeURI(code),
			dataType : "json",
			cache:false,
			success : function(data){
				if(data.code == "0"){
					iframeDialog = dialog({
						title : "上传文件",
						content : "<iframe src='upload.aspx?out=2&code="+encodeURI(code)+"&path="+encodeURI(data.path)+"' frameBorder='0' style='border:none;width:800px;height:500px;'></iframe>"
					}).showModal();
				}else{
					alert("上传码不存在或者已过期");
				}
			}
		});
	}
	var closeWindow = function(flag){
		if(iframeDialog != null){
			iframeDialog.close().remove();
			iframeDialog = null;
		}
	}
</script>