knownasilya / ember-plupload

Ember component for handling uploads using plupload
MIT License
87 stars 53 forks source link

file.read() does not show the `progress` % #132

Open rinoldsimon opened 6 years ago

rinoldsimon commented 6 years ago

i want to preview image before calling file.upload(). So in the uploadImage function i just read the file and display in my browser. queue.progress % remains 0 even after image displayed in browser.

Does queue.progress only works when calling file.upload() ?

hbs

 {{#pl-uploader for="profile-image" name="profile-image" extensions="jpg jpeg" max-file-size="5000000" onfileadd="uploadImage" as |queue|}}
      {{#if queue.length}}
        {{!-- image preview --}}
        <img id="profile-image" src={{profile_photo}}/>
          Uploading..{{queue.progress}}%
      {{/if}}
    {{/pl-uploader}}

js

    uploadImage(file) {
      file.read().then((url) => {
        this.set('profile_photo', url);
      }, (reason) => {
       ...
      });
    }