|
|
|
|
|
|
|
|
|
|
|
|
|
|
temp.upload[e.data]['progress'] = 50; |
|
|
temp.upload[e.data]['progress'] = 50; |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
type: 'POST', |
|
|
|
|
|
url: conf.openapi + "/documents/" + temp.documentid + "/data", |
|
|
|
|
|
data: e.target.result, |
|
|
|
|
|
context: e.data, |
|
|
|
|
|
beforeSend: function(XMLHttpRequest) |
|
|
|
|
|
{ |
|
|
|
|
|
XMLHttpRequest.upload.addEventListener("progress", function(evt){ |
|
|
|
|
|
if (evt.lengthComputable) { |
|
|
|
|
|
var percentComplete = evt.loaded / evt.total; |
|
|
|
|
|
console.log("upload_progress_event", evt); |
|
|
|
|
|
} |
|
|
|
|
|
}, false); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
success: function(data){ |
|
|
|
|
|
console.log("upload_complete",data); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(xhr.upload).on('progress', e.id, function(e) { |
|
|
$(xhr.upload).on('progress', e.id, function(e) { |
|
|
if ( e.lengthComputable ) { |
|
|
if ( e.lengthComputable ) { |
|
|
var progress = Math.floor(e.originalEvent.loaded / e.originalEvent.total * 50); |
|
|
var progress = Math.floor(e.originalEvent.loaded / e.originalEvent.total * 50); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xhr.open("POST", conf.openapi + "/documents/" + temp.documentid + "/data"); |
|
|
xhr.open("POST", conf.openapi + "/documents/" + temp.documentid + "/data"); |
|
|
xhr.send(e.target.result); |
|
|
xhr.send(e.target.result); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
console.log(e); |
|
|
console.log(e); |