console
function upload(blobOrFile) {
console.log(blobOrFile);
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://qmtar.chinacloudapp.cn/api/Project/UploadMedia', true);
xhr.onload = function(e) {console.log(e)};
xhr.send(blobOrFile);
}
document.querySelector('input[type="file"]').addEventListener('change', function(e) {
var blob = this.files[0];
var BYTES_PER_CHUNK = 1024;
var SIZE = blob.size;
var start = 0;
var end = BYTES_PER_CHUNK;
while(start < SIZE) {
upload(blob.slice(start, end));
start = end;
end = start + BYTES_PER_CHUNK;
}
}, false);
<input type="file" />