0

I am trying to send a file via multipart formdata via invoke-restmethod. I don't have write permmision on the server but type filename works fine My command is Invoke-RestMethod -Uri url -Method Post -infile file

Shunya
  • 2,344
  • 4
  • 16
  • 28
Nnnnn
  • 1
  • 1

1 Answers1

0

Maybe file is not available in the PowerShell if its on a network location or if it is read only. The read only problem is described here: https://www.reddit.com/r/PowerShell/comments/pwhsw2/invokerestmethod_method_put_infile_doesnt_work/

basically it is changing permissions as PowerShell has bug here:

Set-ItemProperty -Path <path> -Name IsReadOnly -Value $False

Then try again. If you can't change permissions you might switch to PowerShell 7

An-dir
  • 465
  • 2
  • 13