[ 6 posts ]

Marc Lundgren

  • Offline
  • Profile

3.5.0 Uploader, cancelUpload on 2 files uploading...

Post Posted: Mon May 14, 2012 2:44 pm
+0-
...will effectively halt the entire upload queue.

To easily reproduce this problem follow these steps where I add a cancel button for each file added, then see the error occur.

1. Use the source code provided in the multi files uploader demo: http://yuilibrary.com/yui/docs/uploader/uploader-multiple.html
2. Replace the block Y.each(fileList, function (fileInstance) { with:

Code:
Y.each(fileList, function (fileInstance) {
   fileTable.append("<tr id='" + fileInstance.get("id") + "_row" + "'>" +
      "<td class='filename'>" + fileInstance.get("name") + "</td>" +
      "<td class='filesize'>" + fileInstance.get("size") + "</td>" +
      "<td class='percentdone'>Hasn't started yet</td></tr>");
   
   var button = Y.Node.create('<button type="button" id="' + fileInstance.get("id") + '" class="yui3-button" style="width:400px; height:35px;">Cancel ' + fileInstance.get("name") + '</button>');

   Y.get("body").append(button);

   button.on("click", function() {
      uploader.queue.cancelUpload(fileInstance);
   });
});

3. upload at least three large files (10+ MB).
4. cancel the first file once it begins it begins uploading

Here you will notice the uploader will not not continue to upload files. It can be started again with
Code:
uploader.queue.startUpload();
but I'm not sure if this was intended.

Simon So

  • Username: simonso
  • Joined: Tue Feb 28, 2012 12:58 pm
  • Posts: 5
  • Offline
  • Profile

Re: 3.5.0 Uploader, cancelUpload on 2 files uploading...

Post Posted: Mon May 14, 2012 3:50 pm
+0-
I have tried something similar on my end. Furthermore, once you hit startUpload(), it will start re-uploading the cancelled file instead the next one up.

The event.Filelist array remains unchanged. Unless you manually remove/reset the fileList array.

like : uploader.set("fileList",newArray)

Marc Lundgren

  • Offline
  • Profile

Re: 3.5.0 Uploader, cancelUpload on 2 files uploading...

Post Posted: Mon May 14, 2012 5:03 pm
+0-
Removing the file from the fileList object manually, or splicing the fileList object and running uploadThese are the only work arounds that I've found to work for now. At least there is some sort of work around...

Allen Rabinovich

YUI Developer

  • YUI Developer
  • Offline
  • Profile

Re: 3.5.0 Uploader, cancelUpload on 2 files uploading...

Post Posted: Mon May 14, 2012 10:17 pm
+0-
Hi Marc,

This is, in fact, a bug: the cancelUpload(file) method in the UploaderQueue is not starting the upload of the next file after cancelling the current one. A better workaround for now would be to call "uploader.queue._startNextFile()" every time you cancel a running upload. I created a trac entry for the bug here:

http://yuilibrary.com/projects/yui3/ticket/2532312

Simon: changing the fileList during an active upload has no effect; only changes before an upload initiated will apply (the queue creates its own copy of the fileList, it's stored in uploader.queue.queuedFiles once an upload has started (and that's the actual queue; it shrinks as uploads start and complete).

weezelboy

  • Joined: Mon Jul 23, 2012 3:02 pm
  • Posts: 2
  • Offline
  • Profile

Re: 3.5.0 Uploader, cancelUpload on 2 files uploading...

Post Posted: Mon Jul 23, 2012 3:12 pm
+0-
What's the intended result of calling uploadAll() after cancelling a file? It seems the 2nd call to uploadAll() after a file was cancelled has no effect and I never get a 2nd uploadstart event.

weezelboy

  • Joined: Mon Jul 23, 2012 3:02 pm
  • Posts: 2
  • Offline
  • Profile

Re: 3.5.0 Uploader, cancelUpload on 2 files uploading...

Post Posted: Mon Jul 23, 2012 3:36 pm
+0-
NM, apparently hiding/showing the control was breaking it which is a documented no-no.
  [ 6 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum