title: Unsupported Media Type http response when upload file using c# api.
body: <p>I am using angular and oi.file.js directive from <a href="https://github.com/tamtakoe/oi.file">https://github.com/tamtakoe/oi.file</a></p>
  
  <p>My html looks like this:</p>
  
  <pre><code>&lt;form name="EditOrder" enctype="multipart/form-data"&gt;
    &lt;input type="file" oi-file="options"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Angular controller: </p>
  
  <pre><code>            $scope.file = {};
  
              $scope.options = {
                  change: function (file) {
                      console.log($scope.file);
                      file.$upload('api/fileupload', $scope.file);
                      console.log($scope.file);
                  }
              };
  </code></pre>
  
  <p>And C# api controller:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Net;
  using System.Net.Http;
  using System.Net.Http.Headers;
  using System.Web;
  using System.Web.Http;
  using Ttmc.Core.Database;
  using Ttmc.Core.Files;
  using Ttmc.WebApp.Common;
  
  namespace Ttmc.WebApp.Controllers
  {
      public class FileUploadController: ApiController
      {
          private readonly FileRepository fileRepository;
          private readonly LogHelper&lt;FileController&gt; logHelper;
          private readonly SqlConnectionFactory sqlConnectionFactory;
  
          public FileUploadController()
          {
              logHelper = new LogHelper&lt;FileController&gt;();
              sqlConnectionFactory = new SqlConnectionFactory();
              fileRepository = new FileRepository(new DatabaseFileRepository(sqlConnectionFactory), sqlConnectionFactory);
          }
  
          [HttpPost]
          public HttpResponseMessage Post(FileController.PostFile postFile)
          {
              var request = HttpContext.Current.Request;
              HttpResponseMessage result = null;
              logHelper.LogExecute(() =&gt;
              {
                  if (request.Files.Count == 0)
                  {
                      result = Request.CreateResponse(HttpStatusCode.BadRequest);
                  }
                  var resultFiles = new List&lt;DatabaseFile&gt;();
                  using (var connection = sqlConnectionFactory.Create())
                  using (var transaction = connection.BeginTransaction())
                  {
                      for (var i = 0; i &lt; request.Files.Count; i++)
                      {
                          var postedFile = request.Files[i];
                          var id = fileRepository.AddFile(postedFile.InputStream, postedFile.FileName, postFile.OrderId,
                                                          postFile.RootFolderName, connection, transaction);
                          resultFiles.Add(fileRepository.GetInfo(id, connection, transaction));
                      }
                      transaction.Commit();
                  }
                  result = Request.CreateResponse(HttpStatusCode.Created, resultFiles);
              });
  
              return result;
          }
  
          public class PostFile
          {
              public Guid OrderId { get; set; }
              public string RootFolderName { get; set; }
          }
      }
  }
  </code></pre>
  
  <p>When I try to upload file I get Unsupported Media Type response. </p>
  
  <pre><code>POST /api/fileupload HTTP/1.1
  Host: localhost:12345
  Connection: keep-alive
  Content-Length: 283
  Cache-Control: no-cache
  Pragma: no-cache
  Origin: http://localhost:12345
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko)   Chrome/32.0.1700.76 Safari/537.36
  Content-Type: multipart/form-data; boundary=----WebKitFormBoundary6wBPmLUA5JPOBZYm
  Accept: */*
  </code></pre>