【发布时间】:2013-04-22 00:21:16
【问题描述】:
我可以使用以下 cURL 命令向我的服务器发送 HTTP POST 文本文件:
curl -i -F file=@file.txt http://www.website.com/put_file
服务器需要来自 $_FILES['file'] 的文件。
到目前为止,我有以下内容,但它不起作用:
$url = http://www.website.com/put_file
$file = "c:\file.txt"
$wc = new-object System.Net.WebClient
$wc.UploadFile($url, $file.FullName)
返回0,没有上传到服务器
如何将文件作为 $_FILES['file'] 发送?另外,如何查看服务器的响应?
【问题讨论】:
-
我最终下载了适用于 windows 的 curl 可执行文件,效果非常好!
标签: windows post powershell curl http-post