SOURCE

console 命令行工具 X clear

                    
>
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; // 1MB chunk sizes.
  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" />