title: how to save file in localStorage and later on send it on server in mvc
body: <p>How do we save file in localStorage and later on retrive it and send it on server to save it.</p>
  
  <pre><code>&lt;input id="File1" type="file" onchange="saveLocal();" /&gt;
  &lt;button type="button" onclick="saveServer()"&gt;Sync&lt;/button&gt;
  &lt;script&gt;
      function saveServer()
      {
          var blob = localStorage.getItem("file");
          var form = new FormData();
          form.append("file", blob);
          AjaxPost("/Grades/test", form, function (data) {
              alert(data);
          });
      }
      function saveLocal()
      {
          var file = $("#File1")[0].files[0];
          var reader = new FileReader();
          reader.onload = function (e) {
              localStorage.setItem("file", reader.result);
              $("#File1").val("");
          }
          reader.readAsDataURL(file);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>and server side code is</p>
  
  <pre><code>[HttpPost]
      public ActionResult test(HttpPostedFileBase file)
      {
          return View();
      }
  </code></pre>
  
  <p>when i issue a request file is null how we do that?</p>