title: WebAPI upload error. Expected end of MIME multipart stream. MIME multipart message is not complete
body: <p>I've been following this tutorial to support file uploading as part of MVC4's WebAPI: <a href="http://blogs.msdn.com/b/henrikn/archive/2012/03/01/file-upload-and-asp-net-web-api.aspx" rel="noreferrer">http://blogs.msdn.com/b/henrikn/archive/2012/03/01/file-upload-and-asp-net-web-api.aspx</a>.</p>
  
  <p>When my controller receives the request, it complains that the 'MIME multipart message is not complete.'. Does anyone have any tips on how to debug this? I've tried resetting the stream's position to 0 on the off-chance there was something else reading it before it hit the handler.</p>
  
  <p>My HTML looks like this:</p>
  
  <pre><code>&lt;form action="/api/giggl" method="post" enctype="multipart/form-data"&gt;
      &lt;span&gt;Select file(s) to upload :&lt;/span&gt;
      &lt;input id="file1" type="file" multiple="multiple" /&gt;
      &lt;input id="button1" type="submit" value="Upload" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and my controller's Post method like this:</p>
  
  <pre><code>    public Task&lt;IEnumerable&lt;string&gt;&gt; Post()
      {
          if (Request.Content.IsMimeMultipartContent())
          {
              Stream reqStream = Request.Content.ReadAsStreamAsync().Result;
              if (reqStream.CanSeek)
              {
                  reqStream.Position = 0;
              }
  
              string fullPath = HttpContext.Current.Server.MapPath("~/App_Data");
              var streamProvider = new MultipartFormDataStreamProvider(fullPath);
  
              var task = Request.Content.ReadAsMultipartAsync(streamProvider).ContinueWith(t =&gt;
              {
                  if (t.IsFaulted || t.IsCanceled)
                      Request.CreateErrorResponse(HttpStatusCode.InternalServerError, t.Exception);
  
                  var fileInfo = streamProvider.FileData.Select(i =&gt;
                  {
                      var info = new FileInfo(i.LocalFileName);
                      return "File uploaded as " + info.FullName + " (" + info.Length + ")";
                  });
                  return fileInfo;
  
              });
              return task;
          }
          else
          {
              throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotAcceptable, "Invalid Request!"));
          }
      }
  </code></pre>
  
  <p>Am I missing anything obvious?></p>