Is it possible to use cURL to stream upload a file using POST?

后端 未结 2 1976
花落未央
花落未央 2020-12-31 18:41

Or does PHP not allow this? I have read it is possible using PUT but the server is expecting POST only.

2条回答
  •  遥遥无期
    2020-12-31 19:03

    Curl has already support the stream, try curl --help | grep binary and you will get:

    "--data-binary DATA HTTP POST binary data (H)"

    An example: curl -v -XPOST http://example:port/path --data-binary @file.tar \ -H "Content-Type: application/octet-stream"

提交回复
热议问题