1

I am using yui-uploader from YUI 2.6.0

When an upload error occurs, I disable the uploader, show a warning, and then when the user clicks ok, enable it again.

Subsequent to this, selection of new files works, and the file list is populated correctly. However the uploads do not start. Has anyone encountered this problem? How do you handle restarting with the uploader? Will I need to destroy and recreate the object itself?

In the case where there is no error, I am able to successfully choose (say) 3 files, wait for them to upload, choose 3 more, let those upload, etc.

nunb
  • 339
  • 1
  • 2
  • 14

2 Answers2

2

To expand on what I wrote earlier, the solution I ended up with is to re-create the JS object.

Something like:

function create_uploader() {
        YAHOO.widget.Uploader.SWFURL = "/pub/uploader.swf";
        uploader = new YAHOO.widget.Uploader('uploadercontainer');
        uploader.addListener('contentReady', handleContentReady);
        .. etc ..
}

function onUploadError(event) {
        alert('was not able to upload, check your connection and try again');
        create_uploader(); 
}
nunb
  • 339
  • 1
  • 2
  • 14
  • When I try this I end up with duplicate buttons on the page (none of them function), did you have to destroy anything prior to running the create method a second time? – MetaGuru Feb 12 '14 at 15:45
  • Ok for those who may end up here, I used this to remove the DOM elements related to YUI uploader prior to rebuilding it: http://stackoverflow.com/a/3955238/18309 – MetaGuru Feb 12 '14 at 16:14
0

i have not found a solution without actually reloading the page itself, so that said, the solution is a page reload.

Greg R
  • 83
  • 2
  • 3
  • 11
  • I was iirc able to obtain the same behavior by re-creating the YUI uploader object on error. – nunb Oct 29 '09 at 12:06