欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js實(shí)現(xiàn)帶進(jìn)度條提示的多視頻上傳功能

 更新時(shí)間:2020年12月13日 11:33:43   作者:喵生初現(xiàn)  
這篇文章主要為大家詳細(xì)介紹了js實(shí)現(xiàn)帶進(jìn)度條提示的多視頻上傳功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了js帶進(jìn)度條上傳多視頻的具體代碼,供大家參考,具體內(nèi)容如下

效果:

引用:

 <link rel="stylesheet" href="bootstrap.css" >
 <script src="jquery.fileupload.js"></script>
 <script src="http://malsup.github.com/jquery.form.js"></script>

html:

<div class="form-group">
  <label>產(chǎn)品視頻:</label>
  <div class="videoUpfile">
  <input type="file" name="avatarVideo" class="avatarVideo"><a class="btn deleteAvatarVideo" href="javascript:;" >刪除</a>
  <div class="videoMaterials">
   <div class="progress">
   <div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
    <span class="sr-only">0% Complete</span>
   </div>
   </div>
   <div class="files"></div>
   <div class="showimg"></div>
   <input type="hidden" value="" name="video_id[]">
   <p style="color: #b92c28" class="img_upload_info"></p>
  </div>
  </div>
  <div class="videoUpfile">
  <input type="file" name="avatarVideo" class="avatarVideo"><a class="btn deleteAvatarVideo" href="javascript:;" >刪除</a>
  <div class="videoMaterials">
   <div class="progress">
   <div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
    <span class="sr-only">0% Complete</span>
   </div>
   </div>
   <div class="files"></div>
   <div class="showimg"></div>
   <input type="hidden" value="" name="video_id[]">
   <p style="color: #b92c28" class="img_upload_info"></p>
  </div>
  </div>
</div>

script:

//上傳視頻

$(".avatarVideo").change(function() {
 var _this = $(this);
 _this.wrap("<form class='fileUploadeVideo' action='/admin/uploadimg/addVideo' method='post' enctype='multipart/form-data'></form>");
 _this.parents('.fileUploadeVideo').ajaxSubmit({
 dataType: 'json',
 beforeSend: function () {
  $(".progress").show();
 },
 uploadProgress: function (event, position, total, percentComplete) {
  var percentVal = percentComplete + '%';
  _this.parents('.videoUpfile').find(".progress-bar").width(percentComplete + '%');
  _this.parents('.videoUpfile').find(".progress-bar").html(percentVal);
  _this.parents('.videoUpfile').find(".sr-only").html(percentComplete + '%');
 },
 success: function (data) {
  if(data.code==100) {
  _this.parents('.videoUpfile').find(".files").html("文件名: " + data.video_title);
  _this.parents('.videoUpfile').find("input[type=hidden]").val(data.video_id);
  alert("上傳成功!");
  }else{
  alert("上傳失敗");
  }
 },
 error: function () {
  alert("上傳失敗");
 }
 });

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論