The problem was in the initialize function:
this.initialize = function() {
$uploadForm.data("key", $uploadForm.find("input[name='key']").val());
//binded add function here to let the plugin execute it's default add behaviour
setUploadForm().bind('fileuploadadd' , function(e, data) {
var file;
file = data.files[0];
file.unique_id = Math.random().toString(36).substr(2, 16);
if (!(settings.before_add && !settings.before_add(file))) {
current_files.push(data);
if ($('#template-upload').length > 0) {
data.context = $($.trim(tmpl("template-upload", file)));
$(data.context).appendTo(settings.progress_bar_target || $uploadForm);
} else if (!settings.allow_multiple_files) {
data.context = settings.progress_bar_target;
}
//this part was causing the problem it was adding images for processing which hasn't been processed.
/*if (settings.click_submit_target) {
if (settings.allow_multiple_files) {
return forms_for_submit.push(data);
} else {
return forms_for_submit = [data];
}
} else {
return data.submit();
}*/
}
});
return this;
};