PHP多文件上传源代码记录,含上传确认及Loading图标显示,这段只适用于九品源码的内部框架调用,无实际借鉴意义,仅用于自己平时程序的记录,慎用。
<form class="form-horizontal form-groups-bordered" name="form1" id="form1" method="POST" action="?<?=$AES_obj->aesEn("action=go&banji_id=".$banji_id."&".$pageurl."&time=".time())?>" enctype="multipart/form-data"> <div class="form-group"> <label class="col-sm-2 control-label">选择导入文件</label> <div class="col-sm-4"> <input type="file" name="file[]" id="filelist" class="file2 inline btn btn-default" multiple="multiple" data-label="<i class='entypo-attach'></i> 选择Excel文件,格式:xls" > </div> </div> <div class="form-group"> <div class="col-sm-2"></div> <div class="col-sm-5"> <button type="button" id="daoru" class="btn btn-blue btn-icon icon-left" onClick="action_go()" >开始导入<i class="entypo-check"></i></button> </div> </div> </form>
JS代码:
<script> function action_go(){ if ($("#filelist").val()==''){ alert_go('您没有选择文件!','alert','','error','') return false }else{ //兼容浏览器scrollTop和方法 var sTop_1=parseInt(document.body.scrollTop); var sTop_2=parseInt(document.documentElement.scrollTop); var vvtop=parseInt(sTop_1+sTop_2+100); document.getElementById("my_action").style.top=vvtop+"px"; $('#my_action').modal('show'); } } function action_ok(){ $("#queren").attr("disabled", "disabled"); $("#cz_show").html("<img src='images/16.gif' border='0' /> 请稍后,正在上传并导入数据文件....."); $("#form1").submit() } </script>
DIV确认对话框:
<div id="my_action" class="modal fade" data-backdrop="static" style="z-index:10000;"> <div class="modal-dialog" > <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">操作提示</h4> </div> <div class="modal-body" style=""> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60px" valign="middle"><img src='images/tishi_wen.gif' border='0' /></td> <td style="font-size:14px">确认开始导入?如文件数量过多时,等待期间请勿执行其它操作!</td> </tr> </table> </div> <div class="modal-footer" id="cz_show"> <button type="button" id="queren" class="btn btn-blue" onClick="action_ok()">确认开始</button> <button type="button" class="btn btn-default" data-dismiss="modal">取消操作</button> </div> </div> </div> </div>
以上就是PHP上传大文件二次确认对话框及loading显示防止假死状态【专用】的详细内容,更多关于PHP上传大文件二次确认对话框及loading显示防止假死状态【专用】的资料请关注九品源码其它相关文章!