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
Asked
Active
Viewed 582 times
0
-
Does
show the path of your infile? – An-dir Jul 02 '22 at 15:20 -
Yes, the
is the path of the file I want to send – Nnnnn Jul 02 '22 at 15:59
1 Answers
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