knownasilya / ember-plupload

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

Upload via button only works once #62

Closed mk-conn closed 8 years ago

mk-conn commented 8 years ago

Don't know if I did something wrong, but when I upload some file via the browsers browse button I have to reload the component again to be able to upload another file... heres my template:

{{#if error}}
    <div class="alert alert-danger">{{error}}</div>
{{/if}}

{{#pl-uploader
for="upload-attachment"
onError="handleEerror"
extensions="pdf mp3 mov mp4 mpg m4v txt doc docx xls jpg gif bmp png tiff jpeg"
multiple=true
onfileadd="upload" as |queue dropzone|}}
  {{log "dropzone active: " dropzone.active}}
  <div class="dropzone" id={{dropzone.id}}>
    {{#if dropzone.active}}

      {{#if dropzone.valid}}
          <div class="alert alert-info">
            {{t "event.attachments.drop_to_upload"}}
          </div>
      {{else}}
          <div class="alert alert-warning">
            {{t "event.attachment.file.invalid"}}
          </div>
      {{/if}}

    {{else if queue.length}}

        <div class="progress">
            <div class="progress-bar" role="progressbar" aria-valuenow="{{queue.progress}}" aria-valuemin="0"
                 aria-valuemax="100" style="width: {{queue.progress}}%;">
                Uploading {{queue.length}} files. ({{queue.progress}}%)
            </div>
        </div>

    {{else}}

        <h4>{{t "event.attachments.upload_files"}}</h4>

        <div class="card">

          {{#if dropzone.enabled}}
            {{t "event.attachments.drag_drop_label"}}
          {{/if}}

        </div>

        <div class="form-group">

            <label class="file">
                <input type="file" id="upload-attachment" class="form-control"/>
                <span class="file-custom"></span>
            </label>
        </div>

    {{/if}}
  </div>
{{/pl-uploader}}

I don't see any errors popping up so ... really don't know where to start debugging here. Seems the 'for' property loses the connection to the file-input somehow?

mk-conn commented 8 years ago

Found out, it works with just a html-link (as in your example) - so my problem is solved. I don't know why its not working with a standard file-input but I don't care for now ;)

tim-evans commented 8 years ago

No biggie! Yeah, not sure what may cause this. Plupload tends to do some interesting things.