title: uploading a file and form Data in web Api and angularJS
body: <p>I am following a guide in this <a href="http://chris.59north.com/post/Uploading-files-using-ASPNET-Web-Api" rel="noreferrer">blog</a>  on how to post form Data and 
  a file. I am trying to upload the file in a directory on the server
  have done following but it is not working.</p>
  
  <p>this is the Post function </p>
  
  <pre><code>[HttpPost]
          public async Task&lt;HttpResponseMessage&gt; UploadFile(HttpRequestMessage request)
          {
              String root = HttpContext.Current.Server.MapPath("~/Logo/");
  
              if (!request.Content.IsMimeMultipartContent())
              {
                  throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
              }
  
              var data = await Request.Content.ParseMultipartAsync();
              var httpRequest = HttpContext.Current.Request;
  
              if (data.Files.ContainsKey("file"))
              {
  
                  var file = data.Files["file"].File;      // this is getting the file
                  var fileName = data.Files["file"].Filename; // this is getting the fileName
                 // System.Web.HttpPostedFile filePost = data.Files["file"];
                  String a = root + "" + Path.GetFileName(fileName);
                  string b = a;
                  var postedFile = fileName;                                                  // this is not working
                  var filePath = HttpContext.Current.Server.MapPath("~/Logo/" + fileName);    // can someone help please 
                  postedFile.SaveAs(filePath);                                                // I
  
              }
  
              if (data.Fields.ContainsKey("description"))
              {
                  var description = data.Fields["description"].Value;
              }
  
              return new HttpResponseMessage(HttpStatusCode.OK)
              {
                  Content = new StringContent("Thank you for uploading the file...")
              };
          }
  </code></pre>
  
  <p>how can I save the file to the Directory on the server?</p>