I use the malsup jQuery form with upload. It works with PHP. http://malsup.com/jquery/form/
Is there a nice way to add chunked uploads using malsup? Any suggestions?
var xhr = new XMLHttpRequest();
var percent = $('.percent');
var bar = $('.bar');
/* submit form with ajax request */
$('form').ajaxForm({
dataType: 'json',
beforeSend: function() {
bar.width('0%');
percent.html('0%');
},
uploadProgress: function(event, position, total, percentComplete) {
var pVel = percentComplete + '%';
bar.width(pVel);
percent.html(pVel);
},
success: function(xhr) {
var percentVal = '100%';
bar.width(percentVal)
percent.html(percentVal);
},
complete: function(xhr) {
var url = window.location.origin = window.location.protocol+"//"+window.location.host+"/thank-you/";
window.location.replace(url);
}
});
EDIT: Has anyone else experienced that the upload bar indicator is not working on mobile Chrome (at least it's not working on Chrome for iOS and I have tested with their default examples as well)?
Kind regards Johan