title: MVC controller not receiving data posted with Invoke-RestMethod
body: <p>I'm trying to get something similar to <a href="https://stackoverflow.com/a/36269506">this answer</a> and <a href="https://stackoverflow.com/a/22563552/419956">this answer</a> to work where I utilize <code>Invoke-RestMethod</code> to post some variables and a list of files to a controller. However, AFAICT I've correctly adapted the powershell bits, but the MVC controller doesn't like it.</p>
  
  <p>Here's a repro. In a fresh, new MVC 5 application, I've added this method to the Home controller:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Upload(string description, HttpPostedFileBase[] files)
  {
      if (string.IsNullOrWhiteSpace(description)) return Content("Description is required");
      if (files == null || !files.Any()) return Content("At least one file required");
      return Content("Dummy success.");
  }
  </code></pre>
  
  <p>I try to talk to it like this:</p>
  
  <pre><code>$baseUri = "http://localhost:62441"
  
  $body = @{
      "description" = "Test upload."
      "files" = Get-Content("MyStuff.dll") -Raw
  }
  
  Invoke-RestMethod `
      -Method Post `
      -Uri "$baseUri/home/upload" `
      -Body $body `
      -ContentType "multipart/form-data"
  
  # Outputs "Description is required"
  </code></pre>
  
  <p>Which is a remix of aforementioned (and various other) answers. However, if I run the script the MVC side gets an empty <code>description</code>, and an empty list of files.</p>
  
  <p>Is something in the MVC action causing this? How could I adjust the code (preferably the <em>powershell</em> bit) to make this work?</p>
  
  <p>PS. I've since found <a href="https://stackoverflow.com/a/25083745/419956">this answer</a> that explains how to custom-build the Body, but that's quite a bit of work I'd love to avoid, and given from the answers mentioned in the beginning I suspect that it should actually be possible?</p>