title: How to send PDF blob to MVC controller
body: <p>I've generated a PDF report using JSRepoprts library. The output result is a blob that can be downloaded to the "Downloads" folder. What I need to do is to save the blob in a specific folder on the server. I tried to send the blob using XMLHttpRequest, but I'm receiving the request with empty content in the controller. </p>
  
  <p>The code I wrote is the following</p>
  
  <pre><code>jsreports.export({
          format: 'pdf',
          report_def: def,
          datasets: data_sources,
          outputHandler: function (pdfBlob) {
              $('.report-output-pdf').attr('src', URL.createObjectURL(pdfBlob));
  
               var xhr = new XMLHttpRequest();
               xhr.open('GET', '/reports/saveReport', true);
  
               xhr.onload = function () {       
                   console.log(xhr.responseText);
               };              
               xhr.send(pdfBlob);
          }
      });
  </code></pre>
  
  <p>On the server side (MVC Controller) the code is:</p>
  
  <pre><code>public ActionResult saveReport()
      {
          try
          {
              var r = Request;
              int l = Request.ContentLength; // Received 0
              byte[] ba = r.BinaryRead(r.ContentLength);
  
              return Json(r, JsonRequestBehavior.AllowGet);
          }
          catch (Exception ex)
          {
              return Json(new { Message = ex.Message }, JsonRequestBehavior.AllowGet);
          }
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Rh9iI.png" rel="nofollow noreferrer">Result as shown in debugger</a></p>
  
  <p>Any one have an idea that help me saving the pdf blob to specific directory using the correction of the code above or any other idea? </p>