I am trying to create a script to send a file with a body but somehow is just ends up giving me error code (400) bad request or (412)
so far this is what i have done
$fileBin = [System.IO.File]::ReadAllBytes("$PSScriptRoot\$filePath")
$data = @{
"Time"="$TimeNum"
"Axis1"="$ax1"
"Axis2"="$ax2"
"Point"="$point"
"Date"="$date"
"file"=$fileBin
}
$temp = Invoke-RestMethod -Uri $urisite -Method POST -Body $data -ContentType 'multipart/form-data'
echo $temp
I've tried using inFile but that way I can't add in the contents. Is there any other way to do this?