I'm trying to send different types of files to myself over my local.network using PowerShell. I think I'm onto something with the command;
Invoke-RestMethod -Uri http://192.168.0.164:8000/upload -Method Post -InFile "file.txt"`
But sadly, I get this response;
Invoke-RestMethod :
Error response
Error response
Error code: 400
Message: Field "files" not found.
Error code explanation: HTTPStatus.BAD_REQUEST - Bad request syntax or unsupported method.
The server I'm trying to upload to is just a python module called uploadserver; https://pypi.org/project/uploadserver/
How can I use PowerShell to upload files?
If the server is on your local.network you could mount the server as a.network drive and simply run
Copy-item ./file.txt ./destinationdrive
Or you can use remoting So from your logged in session
$remote_session = New-PSsession
Copy-item ./file.txt -tosession $remote_session ./filepath/file.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.