相关疑难解决方法(0)

使用curl POST多部分/表单数据的正确方法是什么?

我使用这种语法发布文件以及一些参数:

curl -v -include --form "key1=value1" --form upload=localfilename URL
Run Code Online (Sandbox Code Playgroud)

该文件大小约为500K.首先,我看到发送端的内容长度为254.之后服务器响应的内容长度为0.我哪里错了?

这是命令的完整跟踪.

* Couldn't find host xxx.xxx.xxx.xxx in the _netrc file; using defaults
* About to connect() to xxx.xxx.xxx.xxx port yyyy (#0)
*   Trying xxx.xxx.xxx.xxx...
* Adding handle: conn: 0x4b96a0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x4b96a0) send_pipe: 1, recv_pipe: 0
* Connected to xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) port yyyy (#0)
* POST /zzzzzz/UploadFile HTTP/1.1
* User-Agent: curl/7.32.0
* Host: xxx.xxx.xxx.xxx:yyyy …
Run Code Online (Sandbox Code Playgroud)

forms post curl

139
推荐指数
3
解决办法
15万
查看次数

标签 统计

curl ×1

forms ×1

post ×1