是否可以使用cURL通过POST流式上传文件? [英] Is it possible to use cURL to stream upload a file using POST?

查看:676
本文介绍了是否可以使用cURL通过POST流式上传文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

还是PHP不允许这样做?我已经读过可以使用PUT的情况,但是服务器只期待POST.

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

推荐答案

Curl已支持该流,请尝试curl --help | grep binary,您将获得:

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

-数据二进制数据HTTP POST二进制数据(H)"

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

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

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

这篇关于是否可以使用cURL通过POST流式上传文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆