You need to send the file to a remote web server. I am trying to use such powershell code on the client:
$boundary = [guid]::NewGuid().ToString() $file = "D:\test\test.xml" Invoke-RestMethod -Method Post -Uri http://url.url/catcher.php -ContentType "multipart/form-data; boundary=$boundary" -Body [byte]$file code on the server:
<?php $uploaddir = './files/'; $uploadfile = $uploaddir.basename($_FILES['uploadfile']['name']); if (copy($_FILES['uploadfile']['tmp_name'], $uploadfile)){ echo "<h3>Done!</h3>"; } else { echo "<h3>Error!</h3>"; exit; } ?> Log shows:
[Sun Jul 03 00:57:16.687956 2016] [:error] [pid 10870] [client...] PHP Notice: Undefined index: uploadfile in /.../catcher.php on line 5 [Sun Jul 03 00:57:16.739238 2016] [:error] [pid 10870] [client...] PHP Notice: Undefined index: uploadfile in /.../catcher.php on line 9 [Sun Jul 03 00:57:16.756561 2016] [:error] [pid 10870] [client...] PHP Warning: copy(): Filename cannot be empty in /.../catcher.php on line 9 Either PS does not send, or php has problems with getting the file name ...
[byte]$file? Hint: it does not work and should not work. - n01d