浏览代码

优化分片上传

Karson 4 年之前
父节点
当前提交
bba702bd18
共有 1 个文件被更改,包括 1 次插入5 次删除
  1. 1 5
      public/assets/js/require-upload.js

+ 1 - 5
public/assets/js/require-upload.js

@@ -252,11 +252,7 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
                             },
                             uploadprogress: function (file, progress, bytesSent) {
                                 if (file.upload.chunked) {
-                                    var totalBytesSent = 0;
-                                    file.upload.chunks.forEach(function (item) {
-                                        totalBytesSent += item.bytesSent;
-                                    });
-                                    $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor((totalBytesSent / file.size) * 100) + "%");
+                                    $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor((file.upload.bytesSent / file.size) * 100) + "%");
                                 }
                             },
                             totaluploadprogress: function (progress, bytesSent) {