knownasilya/ember-plupload

404 doesn't clear file list

evoactivity opened this issue · 2 comments

I've been working with this today just getting it styled and working on the frontend as I don't have an api endpoint yet. So my uploads were inevitably getting a 404 when I was attempting the uploads, but the files stick around in the queue on a 404, I'd expect those files to be removed from the queue if they fail.

I thought maybe I could do something with the onerror event but that doesn't seem to fire on a 404.

Any guidance would be great, thanks.

have you tried file.destroy(); ?
Example code:

    uploadImage(file) {
      file.read().then(function (url) {
        ...
      });
      file.upload('/api/images/upload').then(function (response) {
        ...
      }, function () {
        file.destroy();
      });
    }

A 404 should leave the file unchanged in case you want to retry. Think of the scenario when a user losses their internet connection.