title: converting canvas to blob using cropper js
body: <p>I have created an application using <strong><a href="https://github.com/fengyuanchen/cropper" rel="noreferrer">cropper.js</a></strong> for cropping an images. The application is working and the image is cropping, after that I am trying to send the cropped image as blob to the server side for storing,</p>
  
  <p>As per the <strong><a href="https://github.com/fengyuanchen/cropper" rel="noreferrer">cropper.js</a></strong> documentation we can use <strong>canvas.toDataURL</strong> to get a Data URL, or use <strong>canvas.toBlob</strong> to get a blob and upload it to server with FormData. when I tried <strong>canvas.toDataURL()</strong> I am getting the base64 string, but actually I need to send the file as blob so I tried with <strong>canvas.toBlob()</strong> but I am getting <code>Uncaught TypeError: canvas.toBlob is not a function</code> in chrome and <code>TypeError: Not enough arguments to HTMLCanvasElement.toBlob.</code> in Firefox</p>
  
  <p>Can anyone please tell me some solution for this</p>
  
  <p>My code is like this</p>
  
  <pre><code>var canvas = $image.cropper("getCroppedCanvas", undefined);
  var formData = new FormData();
  formData.append('mainImage', $("#inputImage")[0].files[0]);
  formData.append('croppedImage', canvas.toBlob());
  </code></pre>