title: Upload a file to an API using Powershell
body: <p>I am trying to post a file to an API, which works perfectly under Linux using this curl command:</p>
  
  <pre><code>curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'Authorization: Token foo_bar' -F content=@'Filename.ending'  'http://test.test.com/api/upload'
  </code></pre>
  
  <p>I don't get how to work with the 'F' Parameter in curl on the Invoke-RestMethod/Invoke-WebRequest command. I tried:</p>
  
  <pre><code>Invoke-WebRequest -Uri $URL -Headers @{Authorization = 'Token '+foo_bar} -Method POST -ContentType 'multipart/form-data'
  </code></pre>
  
  <p>I tried adding <code>-F 'C:\Users\Me\Filename.ending'</code> to my command, I also tried using <code>-InFile 'C:\Users\Me\Filename.ending'</code>, but I always get a response from the API telling me: </p>
  
  <p>{"error":{"code":"GENERAL_ERROR","message":"missing uploaded file 'Filename.ending'"}}</p>
  
  <p>Which probably suggests it wants the file in a different way. I also tried reading it in by <code>Get-Content 'C:\Users\Me\Filename.ending'</code> but had no success. What am I missing?</p>