Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
684 views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

cURL has already support for streams, 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"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...