上传表格input【type="file"】

<script type="text/javascript">
//验证上传的格式
 function clickFileName(upload_field) {
var filename = upload_field.value;
var newFileName = filename.split('.');     
newFileName = newFileName[newFileName.length-1];
if (/^(xls|xlsx|XLS|XLSX)$/.test(newFileName)==false) {                 
alert("上传的文件格式只能为Excel格式(2003或者2007版本的)");
    upload_field.form.reset();
    return false;
}
}
//提交前验证提交的数据
 function verityFile(){
     if($("#userfile").val()==null||$("#userfile").val()==''||$("#userfile").val()=="undefined"){
alert("请选择文件导入!");
return false;
}
     var lockFlag = isLock();
     if (lockFlag){
    alert('已有数据正在导入,请稍后再试!');
    return false;
     }
return true;
 }
 //判断是否有数据正在导入
 function isLock(){
var isLock = false;
$.ajax({
         type:"post",
         async:false,
         url:"<%=basePath%>propertyPayment_Payment_importPropertyInfoLock.do",
         success:function(data,status){
             if(status && data == '0'){
            isLock = true;
             }
         }
     });
return isLock;
 }
 

</script>

        <table width="610px" border="0" cellpadding="1" cellspacing="0">
  <tr>
  <td width="100%">
  <form id="uploadForm" name="uploadForm" method="post" enctype="multipart/form-data" action="***_Payment_importPropertyInfo.do" οnsubmit="return verityFile()">
  <table id="personal_table" border="0" cellpadding="2" cellspacing="1" width="100%" align="center" style="">
                            
    <tr style=" COLOR: #000;" >
    <td width="10%">文件上传:</td>
                                <td width="63%">
                                   <input type="file" id="userfile" name="userfile" οnchange="clickFileName(this)" >
                                </td>
    </tr> 
                            
                            <tr >
    <td nowrap="nowrap" ></td>
    <td > 
                                   <input class="input_img"  type="submit"   value="提交"/>
                                </td>
    </tr>
  </table>


</form>
  </td>
  </tr>
</table>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值