【问题标题】:Why Slingshot uploader callback is executed only once when uploading several files to S3?为什么 Slingshot 上传器回调在上传多个文件到 S3 时只执行一次?
【发布时间】:2015-07-15 11:29:28
【问题描述】:

我每次上传都会实例化一个SlingShot uploader 来处理多个文件上传。

更具体一点:

  1. 我使用Blaze.renderWithData(Template.uploadItem, file, targetNode); 在我的_.each 循环中为每次上传渲染一个模板。请参阅下面的循环:

'change .fileBrowse':function(event, template){ _.each(event.currentTarget.files, function(file){ //...

  1. 我在之前填写在 _.each 循环中的本地集合中跟踪每个上传状态(进度除外)的状态..

  2. 我在我的Template.uploadItem.created 函数中实例化SlingShot uploader,方法是将它附加到我的模板实例对象(即this.uploader = new Slingshot.Upload( ...

  3. 我使用Template.instance().uploader 到达它,如此progress 帮助代码所示

    progress: function () { return Math.round(Template.instance().uploader.progress() * 100); }

问题:上传者回调仅在最后一个文件发布后调用一次。其他一切正常,但我无法更新我的 UI,因为我的本地集合中的状态没有更新,因为它应该在执行回调时更新。

【问题讨论】:

    标签: meteor meteor-slingshot


    【解决方案1】:

    好的,问题解决了,这是一个愚蠢的错误:我使用了一个公共变量来存储文件名,所以它从一个模板被盗到另一个模板。

    【讨论】:

      猜你喜欢
      • 2018-12-16
      • 1970-01-01
      • 2015-06-16
      • 1970-01-01
      • 2016-11-22
      • 1970-01-01
      • 1970-01-01
      • 2020-08-11
      • 2018-03-28
      相关资源
      最近更新 更多