| if ( temp.documentid == null ) { | if ( temp.documentid == null ) { | ||||
| $.post(conf.openapi + "/documents", {}, function(data) { | $.post(conf.openapi + "/documents", {}, function(data) { | ||||
| console.log(data); | |||||
| temp.documentid = data.id; | |||||
| handle_uploads(ev); | handle_uploads(ev); | ||||
| }) | }) | ||||
| } | } | ||||
| function handle_uploads(ev) { | function handle_uploads(ev) { | ||||
| return true; | |||||
| 1 | |||||
| $.each(ev.dataTransfer.files, function(id,file) { | $.each(ev.dataTransfer.files, function(id,file) { | ||||
| var fileid = temp.upload.length(); | var fileid = temp.upload.length(); | ||||
| temp.upload.push({ | temp.upload.push({ | ||||
| } | } | ||||
| else { | else { | ||||
| var reader = new FileReader(); | var reader = new FileReader(); | ||||
| reader.readAsBinaryString(file); | |||||
| reader.onloadend = function() { | |||||
| } | |||||
| var data; | |||||
| reader.onloadend = function(e) { | |||||
| $.post(conf.openapi + "/documents/" + temp.documentid + "/data", e.result, function(data) { | |||||
| console.log(data); | |||||
| }, file.type) | |||||
| }; | |||||
| reader.readAsArrayBuffer(data); | |||||
| } | } | ||||
| }); | }); | ||||
| return true; | return true; |