title: MultipartFormDataStreamProvider and reading file immediately after its uploaded fails sometimes
body: <p>I have some Web API code that I've assembled from SO posts and other sites. However, the Task stuff is still new to me. I'm trying to copy an uploaded file to a new location, but sometimes (not all the time) I get an exception while trying to copy the file. The exception indicates that the file is in use by another process. It doesn't happen every time, though. I think I need to move the copy operation somewhere else. Here's my code. Any suggestions?</p>
  
  <pre><code>var provider = new MultipartFormDataStreamProvider(uploadroot);
                  var task = Request.Content.ReadAsMultipartAsync(provider).ContinueWith&lt;HttpResponseMessage&gt;(t =&gt;
                  {
                      if (t.IsFaulted || t.IsCanceled)
                          throw new HttpResponseException(HttpStatusCode.InternalServerError);
  
                      var docConversionId = Guid.NewGuid().ToString("N");
                      var sourceFilePath = Path.Combine(uploadroot, provider.FileData.First().LocalFileName);
                      var destinationFilePath = Path.Combine(inboxroot, docConversionId);
  
                      File.Copy(sourceFilePath, destinationFilePath);
  
                      var response = new HttpResponseMessage(HttpStatusCode.OK);
                      response.Content = new StringContent(docConversionId);
                      //response.Content.Headers.Add("DocumentConversionId", docConversionId);
                      return response;
                  });
                  return task;
  </code></pre>