|
|
@@ -241,10 +241,35 @@ function upload_handler() { |
|
|
|
|
|
|
|
function upload_read_event(e) { |
|
|
|
if ( e.type == 'progress' ) { |
|
|
|
if ( e.lengthComputable ) { |
|
|
|
var progress = Math.floor(e.originalEvent.loaded / e.originalEvent.total * 50); |
|
|
|
if ( progress < 1 ) { progress = 1; } |
|
|
|
if ( progress > 49 ) { progress = 49; } |
|
|
|
temp.upload[e.data]['progress'] = progress; |
|
|
|
} |
|
|
|
} |
|
|
|
else if ( e.type == 'load' ) { |
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
|
|
|
|
temp.upload[e.data]['progress'] = 50; |
|
|
|
|
|
|
|
$(xhr.upload).on('progress', e.id, function(e) { |
|
|
|
if ( e.lengthComputable ) { |
|
|
|
var progress = Math.floor(e.originalEvent.loaded / e.originalEvent.total * 50); |
|
|
|
if ( progress < 1 ) { progress = 1; } |
|
|
|
if ( progress > 49 ) { progress = 49; } |
|
|
|
temp.upload[e.data]['progress'] = 50 + progress; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
$(xhr.upload).on('load', e.id, function(e) { |
|
|
|
temp.upload[e.data]['progress'] = 100; |
|
|
|
console.log(e); |
|
|
|
}); |
|
|
|
|
|
|
|
xhr.open("POST", conf.openapi + "/documents/" + temp.documentid + "/data"); |
|
|
|
xhr.send(e.target.result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
console.log(e); |