cURL命令行上传multipart文件

时间:2016-02-11 14:06:47

标签: post curl multipartform-data postman

我正在尝试使用cURL将文件上传到服务器。这是我正在运行的命令:

curl -v -F content=out.txt -F upload=@/Users/serbans/out.txt -H "Content-Type:multipart/form-data"  -X POST  http://10.11.12.13:8080/myapp/v1/jobs/90/stages/91/resources/?relativePath=&description=&content=

这是我得到的输出:



Connected to 10.11.12.13 (10.11.12.13) port 8080 (#0)
> POST /myapp/v1/jobs/90/stages/91/resources/?relativePath= HTTP/1.1
> Host: 10.11.12.13:8080
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Length: 438
> Expect: 100-continue
> Content-Type:multipart/form-data; boundary=------------------------3d7cdcd27fb3bc0c
> 
< HTTP/1.1 100 Continue
< HTTP/1.1 400 Bad Request
< Server: Apache-Coyote/1.1
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Thu, 11 Feb 2016 13:55:00 GMT
< Connection: close
< 
{
  "httpStatus" : 400,
  "message" : "Required MultipartFile parameter 'content' is not present"
* Closing connection 0
}
&#13;
&#13;
&#13;

然而,当我使用谷歌Chrome的邮差时,它运行正常。这就是我在Postman中的表现:

你知道我能做些什么吗?

感谢您的帮助。

此致 谢尔班

0 个答案:

没有答案