<script type="text/javascript" src="../js/jquery.form.js"></script>
{literal}
<style type="text/css">
#upload_ok{ display: none; border:1px solid  #D2F0FF; margin:10px;padding:3px; line-height:180%; text-align: left; background-color:#F7FCFF;}
#upload_data{ display:none; text-align:center;}
</style>
<script  type="text/javascript">
	function inArray(v,ary){
		for(k in ary){
			if(ary[k]==v)return true;
		}
		return false;
	}
	$(document).ready(function(){
		$("#upload_file_set_action").submit(function(){
			v = $("#tag").val();
			var t = v.split('.').pop().toLowerCase();
			var ary = new Array('jpg','gif','png','tar','7z','zip','rar','doc','xls','ppt','pps','flv','swf');
			if($.inArray(t, ary)==-1){
				alert('系统不允许该类文件上传.');
				return false;
			}
			$(this).ajaxSubmit({
			 success:function(response){
					$("#file_loading").html('');var ee = response.split('|');var e = ee[0];var m = ee[1];
					switch(e){
						case '1':
						alert(m);return false;
						break;
						case '2':
						var end = m.split('+');
						var file = end[0];
						var size = end[1];
						var file_type = $.trim(end[2]);
						var n = $.trim(end[3]);//文件名
						$("#upload_ok").show().html('文件上传成功:'+'<br />'+file+'<br />'+'文件大小:'+size);
						var string = '';
						$("#hidden_file").val(file);
						switch(file_type){
							case 'image':
					string = '<img onclick="set_data(this);" style="cursor:pointer" src="'+file+'" width="223" height="220" /><br /><br /><input type="button" value="选 中" onClick="set_data(this);"/>';
							break;
							case 'flash':
							case 'flv':
							case 'default':
							    string = ' 	<li class="li_list">文件名:'+n+' 文件大小:'+size+' <span style="cursor:pointer;" name="" onclick="set_data(this);" name="'+file+'">加入</span></li>';
							break;
							
						}
						$("#upload_data").empty().show().html(string);
						return true;
						break;
						default:alert(response);return false;
				   }
			   }
			 });
			return false;
		})
	})
	function set_data(){
		var v = $("#hidden_file").val();
		$(file_children_obj).val(v)
		$.closeLayer();
		$(".window-container").remove();
		window.frames["main"].show_select()
		$(file_children_obj).focus();
		return false;	
	}
</script>
{/literal}

<input type="hidden" value="{$files}"  id="hidden_file"/>
	<div>
    <table width="100%">
    	<tr>
        	<td>
            <form method="post" id="upload_file_set_action" action="admincp.php?action=file" enctype="multipart/form-data">
            	<input type="file" name="upload_files_self" id="tag" />
                <input type="submit" value="上传"  class="form_submit" style="border: 1px solid rgb(20, 73, 131); margin: 1px 3px; padding: 2px 4px 1px; background-color: rgb(20, 73, 131); color: rgb(255, 255, 255); cursor: pointer;"/>
                <div class="red" style="line-height:180%">
系统中只允许上传:jpg,png,gif,tar,7z,zip,flv,swf,rar,doc,xls,ppt,pps格式的文件,大小未限制,但受限于服务器上传大小配置.
                文件管理请到: 模块插件->文件管理 处操作
                </div>
                </form>
            </td>
        </tr>
    </table>
    <br  class="clear"/>
 <div id="upload_ok"></div>
 <div id="upload_data" {if $is_pic} style="display:block;"{/if}>
 	{if $is_pic}
 	<img  onClick="set_data(this);" src="{$files}" width="223"  style="cursor:pointer" height="220"/>
    <br /><input type="button" value="选 中" onClick="set_data(this);"/>
    {/if}
 </div>
</div>
</body>
</html>
