The issue is with your calls to setParams
. You are effectively overwriting the params for all existing files with each call to setParams
. Instead, you should be targeting a specific file with each call to setParams
. setParams
allows you to do this by specifying a file ID as a parameter to the setParams
call. For example:
this.uploader.on('submitted', function(event, id, name) {
var attachment = new Market.InboxPage.Models.Attachment(); // generates a new model with a unique ID
self.attachments[attachment.cid] = attachment; // self.attachments is a model collection
self.uploader.setParams({'cid': attachment.cid}, id); });
Notice how I switched your logic to the submitted
event, which is called after the file has been successfully submitted, and an ID is available.