我想通过PowerShell上传到我的主机。
但这对我来说是不可能的,我面临各种障碍。 我来到互联网找到答案
$uri = "http://myurl.com/uploader.php"
$txtpath="C:\Users\masod\Desktop\tt.txt"
Invoke-RestMethod -Uri $uri -Method post -InFile $txtpath
我的PHP代码:
<?php
$file_name = $_FILES['UploadedFile']['name'];
$target_path = "uploads/".$file_name;
if(move_uploaded_file($_FILES['UploadedFile']['tmp_name'], $target_path)) {
echo "ok";}
else {
echo "no ok";}
?>