Handling errors with YUI's uploader

745 Views Asked by At

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.

2

There are 2 best solutions below

2
On BEST ANSWER

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(); 
}
1
On

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