I am trying to upload a jpg to a web server using a POST method.
Here are the fields I'm submitting to:
<input type="file" name="myFile">
<input type="submit" value="Upload">
This is the powershell error I get when I run the ps1: + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
$FileContent = [System.IO.File]::ReadAllBytes("C:\<path to file>\4242.jpg")
$Fields = @{"filename"=$FileContent ; "name"="myFile"}
Invoke-RestMethod -Uri $Uri -ContentType 'multipart/form-data' -Method Post -Body $Fields
The pcap shows the multipart dissector could not find a required parameter.
# Not reading in file correctly "name=myFile&filename=System.Byte%5b%5d" in pcap
Any idea what I'm missing?