<?php include $this->admin_tpl('meta');?>
<title>数据导入 - YzmCMS内容管理系统</title>
</head>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)" id="myform">
		<ul>
			 <li style="height: 35px"><label><span class="c-red">*</span><?php echo $title;?>：</label>
				<span class="btn-upload form-group">
				  <input class="input-text upload-url radius" type="text" readonly style="display:inline;width:230px"><a href="javascript:void();" class="btn btn-primary radius" style="height: 30px;font-size: 14px;"><i class="Hui-iconfont">&#xe642;</i> 浏览文件</a>
				  <input type="file" name="data_import" class="input-file">
				</span>
			 </li>
			 <li><span class="c-red">注意： 如现有的数据与导入的数据冲突，导入数据会覆盖现有数据！</span></li>				 
			<li>
				<input type="hidden" name="dosubmit" value="1">
			<input class="dosubmit w_120 btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			<input class="btn w_120 btn-default radius" type="button" value="取消" onclick="yzmcms_close()">
		    </li>
		</ul>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer');?>

<script type="text/javascript">

	function dosub(obj){
		if($("input[name='data_import']").val()==''){
		layer.msg('请上传文件！');
		return false;
		}
		layer.msg('正在上传中……', { icon: 16, shade: 0.21, shadeClose:true, time:0 });
		var form = document.getElementById("myform");
		var data = new FormData(form);
        $.ajax({
            type: 'POST',
            url: '<?php echo $url;?>', 
            data: data,
			dataType: "json", 
			processData: false,
			contentType: false, 
		    dataType: "json", 
            success: function (msg) {		
				if(msg.status == 1){
					layer.msg(msg.message, {time: 2000, icon:1}, function (){
						parent.location.reload();
					});     
			    }else{
					layer.msg(msg.message, {time: 3000, icon:2});
				}
            }
        })		 
		return false;			 
	}
</script> 

</body>
</html>