title: How to save uploaded file data into text file locally ? webapi
body: <p>I have a file upload control and once i browse a file (may be image/text) and click on save means the file should be saved to some folder in my Local Computer . </p>
  
  <p><strong>I am trying like :</strong></p>
  
  <pre><code>self.save =function(){
  
  var formdata = new FormData(); //FormData object
  
  var opmlFile = $('#FFtoSP')[0]; // i get my entire uploaded file details 
  formdata.append("opmlFile", opmlFile.files[0]); // i am appending to formdata
  
   // Now my formdata holds the data and now how come i save it in text file in my local machine dynamiclly 
  
  };
  </code></pre>
  
  <p><strong>My view :</strong></p>
  
  <pre><code>&lt;form&gt;
   &lt;input name="file" type="file" id="FFtoSP"  /&gt;
   &lt;input type="button" id=""  value="save" data-bind="click:$data.save" /&gt; 
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>My controller code :</strong></p>
  
  <pre><code>[HttpPost]
  public ActionResult Upload(string id)
  {
  
      string uploadedPath = string.Empty;
      for (int i = 0; i &lt; Request.Files.Count; i++) // i get count zero for IE and one for other browsers
      {
          HttpPostedFileBase file = Request.Files[i]; //Uploaded file
  
          //Use the following properties to get file's name, size and MIMEType
          int fileSize = file.ContentLength;
          string fileName = Path.GetFileName(file.FileName);
          fileName = "Contract" + "_" + "CreateContract" + "_" + fileName;
          string mimeType = file.ContentType;
          var path = Path.Combine(Server.MapPath("~/Content/Upload"), fileName);//path where i want to save
  
  
          //To save file, use SaveAs method
          file.SaveAs(path); //File will be saved in application root 
  
  
      }
      return Json(uploadedPath);
  
  }
  </code></pre>
  
  <p>Any clues can be of great Help</p>