视频上传

 

 视频上传

<!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>
  <title> 视频上传 </title>
  <meta http-equiv="pragma" content="no-cache">
  <meta http-equiv="cache-control" content="no-store">  
  <meta http-equiv="expires" content="0">    
  <meta http-equiv="Content-Type" content="text/html;charset=GBK">
 </head>

 <body>


<table width="100%" border="0" cellpadding="1" cellspacing="1" class="sj-word-2" bgcolor="#BCBCBC">
    <tr>
        <td width="100%" height="35" colspan="4" class="td-02">
            <div id="file_div" style="width: 100%;">
                从本地上传:
                <html:file styleId="formFile" property="formFile" name="zxpttrainmanagerForm"
                    οnchange="uplaodSubmit();" size="50" ></html:file>
                  视频支持flv格式
            </div>
            <div id="tip_div" style="display: none;width: 100%;">
                正在上传视频,请稍候!
            </div>
        </td>
    </tr>
</table>

<script type="text/javascript">
	var file_html="";
	
	$(function() {
		file_html=$("#file_div").html();
		//alert(file_html);
		$(window.parent.document.getElementById("toSaveBtn")).attr("disabled",false);
		//延迟700毫秒后,再调整页面的高度
		setTimeout(getHeight,500);		
	});
	function getHeight() {
		window.parent.document.getElementById("attacheFrame").height = document.body.scrollHeight
				+ "px";
	}
	//提交上传具体资源
	function uplaodSubmit() {
		if (zxpttrainmanagerForm.formFile.value == "") {
			alert("请选择具体资源");
			zxpttrainmanagerForm.formFile.focus();
			return;
		} else {
			if(!checkFile()){
				return;
			}
			disableAll();
			$("#file_div").hide();
			$("#tip_div").show();
			$(window.parent.document.getElementById("toSaveBtn")).attr("disabled",true);
			zxpttrainmanagerForm.submit();
		}
	}

	function deleteFile(obj, flag, id) {
		if (confirm("删除后将无法恢复,您确认删除吗?")) {
			var _url = "zxpxglFile.do?method=deleteFile&ai_id=" + id;
			if (flag == "tmp") {
				_url = "zxpxglFile.do?method=deleteFileTmp&id=" + id;
			}
			$.ajax({
				url : _url,
				cache : false,
				success : function(data) {
					if(id!="-1"){
						if (data == "0") {
							alert("删除失败!");
						} else {
							$(obj.parentNode.parentNode).remove(); // 删除当前节点的父节点的父节点
							getHeight();
						}						
					}					
				}
			});
		}
	}
	
	function checkFile() {
		var filepath = $("#formFile").val();
		
		var extStart=filepath.lastIndexOf(".");
		var ext=filepath.substring(extStart,filepath.length).toUpperCase();
		//alert(ext);
		if (ext != ".FLV") {
			alert("上传视频仅限于flv(FLV)格式的视频");
			//alert(file_html);
            //用替换的方式,清空file中的值
			$("#file_div").html(file_html);
			return false;			
		}
		return true;
	}
	
</script>

 </body>
</html>


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值