title: Checksum Error while uploading files to BackBlaze (B2) using Ajax request
body: <p>I have spent an awful lot of time trying to upload files to b2 using clientside ajax requests (vue-dropzone.js), and even though I supplied the file's valid sha1 checksum, the b2 server still responds with &quot;checksum did not match data received&quot; with status code 400. I've checked and rechecked the checksums with all the tools I have and I'm still not able to trace the source of the error. Its as if something happens to the file while its in transit or something.</p>
  <p>I've uploaded the same files using the command line tool and it works fine but when I upload via ajax using the exact same sha1 checksum it doesn't work.</p>
  <p>My questions are:</p>
  <ol>
  <li><p>Does b2 even allow file uploads through ajax?</p>
  </li>
  <li><p>If it does allow uploads via ajax then what am i doing wrong?</p>
  </li>
  <li><p>Does the files remain valid when uploaded using &quot;X-Bz-Content-Sha1&quot;, &quot; do_not_verify&quot;. Cause I've tried that only to get invalid files when I downloaded them back.</p>
  </li>
  <li><p>Are there other things I need to know about uploading files to b2 using ajax requests</p>
  </li>
  </ol>
  <p>Please view my ajax codes see if I got anything wrong:</p>
  <pre><code>             sending(file, xhr, formData) {
                  // This function runs for each file right before they are sent by dropezone.
                  // This is a good opportunity to insert file specific values
                  // in this case the file's upload url, name and auth token
                  let fileName = '';
                  console.log('this is file type', file.type);
                  if (file.type.includes('image')) {
                      fileName = 'images/${uuid.v1()}.png';
                  } else if (file.type.includes('video')) {
                      fileName = 'videos/${uuid.v1()}.${file.type.split(' / ')[1]}';
                  }
      
                  const url = appConfig.serverAddress + '/catalog/submitFiles';
                  console.log('this is sha1_hash', this.uploadInfo.sha1_hash);
                  // open the xhr request and insert the file's upload url here
                  xhr.open('Post', this.uploadInfo.url, true);
      
                  // set b2's mandatory request headers
                  // xhr.setRequestHeader(
                  //  'Authorization',
                  //  'Bearer ' + store.getters.getUserIdToken,
                  // );
                  xhr.setRequestHeader('Authorization', this.uploadInfo.authorizationToken);
                  xhr.setRequestHeader('X-Bz-Content-Sha1', this.uploadInfo.sha1_hash);
                  xhr.setRequestHeader('X-Bz-File-Name', fileName);
                  xhr.setRequestHeader('Content-Type', 'b2/x-auto');
      
                  formData = new FormData();
                  formData.append('files', file);
      
                  // the rest will be handled by dropzones upload pipeline
              }
  </code></pre>