title: uncaught TypeError cannot read property '0'
body: <p>I am trying to upload a file using javascript and asp.net mvc 5. But I am getting this error.</p>
  
  <blockquote>
    <p>uncaught typeError cannot read property '0'</p>
  </blockquote>
  
  <p>Here is my codes :  </p>
  
  <pre><code>$("#btnReciveDocument").click(function (e) {
      e.preventDefault();
      debugger;
      var formdata = new FormData(); //FormData object
      var fileInput = $("#fileInput")
  
      //uncaught typeerror cannot read property '0'
      formdata.append(fileInput.files[0].name, fileInput.files[0]);
  
      var xhr = new XMLHttpRequest();
      xhr.open('POST', '/Home/Upload');
      xhr.send(formdata);
      xhr.onreadystatechange = function () {
          if (xhr.readyState == 4 &amp;&amp; xhr.status == 200) {
              alert(xhr.responseText);
          }
      }
  });
  </code></pre>