moxiecode/plupload — Issue #463: UI Widget not properly handling queue with detected upload failures 
Author: dsteinbrunner
Created: 2012-01-17 18:17:21+00:00
State: open

While integrating the plupload widget into an existing environment I came across a situation where all files failed to upload properly and I noticed that the widget was not reacting as expected. It would appear that every other upload had failed and the others had not been tried but using the inspector/firebug showed that all files had been sent and a JSON response reflecting failure had been received. This was with the html5 runtime but checked other runtime and found similar issues so I decided to create a reduction to better examine the issue. I'll note that I am using the latest 1.5.2 release of plupload.

Here is the upload_custom_fail.php I created:

```php

```

and here is the javascript portion of the jquery_ui_widget.html I am using:

```javascript
$(function() {
$("#uploader").plupload({
// General settings
runtimes : 'html4,html5,flash,browserplus,silverlight,gears,html4',
url : '../upload_custom_fail.php',
max_file_size : '256mb',
multipart: true,
multiple_queues: false,
flash_swf_url : '../../js/plupload.flash.swf',
silverlight_xap_url : '../../js/plupload.silverlight.xap',
init: attachCallbacks
});

function attachCallbacks(uploader) {
uploader.bind('Error', function(up, args) {
console.log('[error] ', args);
});

uploader.bind('FileUploaded', function(up, file, response) {
console.log("file uploaded: "+file.id);
console.log(response);
var res = response.response;
if (res) {
var objResponse = JSON.parse(res);
if (objResponse.upload_status = 'failed') {
up.trigger('Error', {
code : -300, // IO_ERROR
message : 'Upload Failed',
details : file.name + ' failed',
file : file
});
return;
}
}
});
}
});
```

Using this I am able to see that the html4 runtime acts just like html5 except that it is actually not sending all requests to the server but just the every other one that is being shown as failing. Silverlight seems to do everything right except that is still shows 2 files queued on the "add files" button. Flash also shows 2 files queued but also fails to send the last file sometimes and other times it reacts is yet another way.

Is anyone else able to duplicate this type of behavior? Is this a known issue? Is my js code at fault for some reason? Any thoughts on what areas of the codebase need to be looked if this is a plupload related problem?