title: Webapi formdata upload (to DB) with extra parameters
body: <p>I need to upload file sending extra paramaters.</p>
  
  <p>I have found the following post in stackoverflow: <a href="https://stackoverflow.com/questions/17177237/webapi-ajax-formdata-upload-with-extra-parameters">Webapi ajax formdata upload with extra parameters</a></p>
  
  <p>It describes how to do this using MultipartFormDataStreamProvider and saving data to fileserver. I do not need to save file to server, but to DB instead. 
  And I have already working code using MultipartMemoryStreamProvider, but it doesn't use extra parameter. </p>
  
  <p>Can you give me clues how to process extra paramaters in webapi? </p>
  
  <p>For example, if I add file and also test paramater:</p>
  
  <pre><code>data.append("myParameter", "test"); 
  </code></pre>
  
  <p>Here is my webapi that processes fileupload without extra paramater:</p>
  
  <pre><code>if (Request.Content.IsMimeMultipartContent())
  {               
      var streamProvider = new MultipartMemoryStreamProvider();
      var task = Request.Content.ReadAsMultipartAsync(streamProvider).ContinueWith&lt;IEnumerable&lt;FileModel&gt;&gt;(t =&gt;
      {
          if (t.IsFaulted || t.IsCanceled)
          {
              throw new HttpResponseException(HttpStatusCode.InternalServerError);
          }
  
          _fleDataService = new FileDataBLL();
          FileData fle;
  
          var fleInfo = streamProvider.Contents.Select(i =&gt; {         
              fle = new FileData();
              fle.FileName = i.Headers.ContentDisposition.FileName;
  
              var contentTest = i.ReadAsByteArrayAsync();
              contentTest.Wait();
              if (contentTest.Result != null)
              {
                  fle.FileContent = contentTest.Result;
              }                       
  
              // get extra parameters here ??????
  
              _fleDataService.Save(fle);
  
              return new FileModel(i.Headers.ContentDisposition.FileName, 1024); //todo
          });
          return fleInfo;
      });
      return task;
  }
  </code></pre>