code: function getBase64 (file) { 
      var reader = new FileReader();
      reader.readAsDataURL(file);
      reader.onerror = function (error) {
          console.log('Error: ', error);
      };
      return reader;
  }
docs: this example uses fixtures to catch requests and simulate file upload server