| xhr: function() | xhr: function() | ||||
| { | { | ||||
| var xhr = $.ajaxSettings.xhr(); | var xhr = $.ajaxSettings.xhr(); | ||||
| $(xhr.upload).on('progress', e.data, function(evt, id) { | |||||
| // xhr.upload.addEventListener("progress", function(evt){ | |||||
| if (evt.lengthComputable) { | |||||
| var progress = Math.floor(evt.loaded / evt.total * 50); | |||||
| if ( progress < 1 ) { progress = 1; } | |||||
| if ( progress > 49 ) { progress = 49; } | |||||
| temp.upload[id].progress = 50 + progress; | |||||
| console.log("upload_progress_event", evt); | |||||
| xhr.upload.addEventListener("progress", (function(evt){ | |||||
| var id = e.data; | |||||
| return function() { | |||||
| if (evt.lengthComputable) { | |||||
| var progress = Math.floor(evt.loaded / evt.total * 50); | |||||
| if ( progress < 1 ) { progress = 1; } | |||||
| if ( progress > 49 ) { progress = 49; } | |||||
| temp.upload[id].progress = 50 + progress; | |||||
| console.log("upload_progress_event", evt); | |||||
| } | |||||
| } | } | ||||
| }); | |||||
| //}, false); | |||||
| })(), false); | |||||
| return xhr; | return xhr; | ||||
| }, | }, | ||||
| success: function(id, status, xhr){ | success: function(id, status, xhr){ |