Skip to content

Upload Example - Progress Doesn't Work Exactly As Shown #103

@sotarules

Description

@sotarules

In the main documentation, an example is presented that has a template variable {{progress}} which is intended to return the progress as a completion percentage. I worked with that example for a little while, and in my own testing it did not work as shown, so I did some digging and checked the demo programs.

I learned that the FileUpload object has property progress, but progress is an instance of ReactiveVar as opposed to a simple property; therefore, to get the value of the progress it is necessary to call FileUpload.progress.get() and I noted that this is precisely what the demo program does to show progress.

For a moment, I was scratching my head wondering whether Meteor template variables might implicitly call .get if the template references a ReactiveVar. If this is so please forgive me and ignore this report; otherwise, the documentation should be updated to illustrate the call to .get.

In my case, to solve the problem, I coded a special helper to get the percent complete as shown:


     percentComplete : function() {

        var fileUpload;

        fileUpload = Template.instance().currentUpload.get();
        if (!fileUpload)
            return;

        return fileUpload.progress.get();
    }

Thanks in advance for your attention. By the way we love Meteor-Files and we're using it in all cases where file uploads are needed. We have backed away from CollectionFS for a variety of reasons.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions