I am trying to upload a file to a URL. I have tried both these approaches:
Invoke-RestMethod -Uri $uploadUrl -Method Put -Headers $uploadHdrs -InFile $uploadFilePath
Invoke-RestMethod -Uri $uploadUrl -Method Put -body $uploadFileBody -Headers $uploadHdrs
Error I am getting:
Invoke-RestMethod : You must write ContentLength bytes to the request stream
before calling [Begin]GetResponse.
If I add in the -TransferEncoding
param, I get errors from the server saying unsupported.
What can I do to include the content length?