Ok ho trovato il problema:
Codice HTML:
//jQuery Ajax to Post form data
$.ajax({
url : post_url,
type: "POST",
contentType: false,
cache: false,
data : form_data
processData:false,
xhr: function(){
//upload Progress
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
xhr.upload.addEventListener('progress', function(event) {
var percent = 0;
var position = event.loaded || event.position;
var total = event.total;
if (event.lengthComputable) {
percent = Math.ceil(position / total * 100);
}
//update progressbar
$(progress_bar_id +" .progress-bar").css("width", + percent +"%");
$(progress_bar_id + " .status").text(percent +"%");
}, true);
}
return xhr;
},
mimeType:"multipart/form-data"
}).done(function(res){ //
$(my_form_id)[0].reset(); //reset form
$(result_output).html(res); //output response from server
submit_btn.val("Upload").prop( "disabled", false); //enable submit button once ajax is done
});
}
}
$(result_output).html(""); //reset output
$(error).each(function(i){ //output any error to output element
$(result_output).append('<div class="error">'+error[i]+"</div>");
});
//function to format bites bit.ly/19yoIPO
function bytesToSize(bytes) {
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes == 0) return '0 Bytes';
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
}
});
è la funzione ajax per la barra di avanzamento.
Cos'è che devo modificare?