php - 在 owncloud 中使用 CURL 恢复上传
问题描述
我正在使用 curl 请求将文件上传到 owncloud。如果连接中断如何恢复上传?因为我必须上传大文件。下面是我的代码
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://server/owncloud/remote.php/webdav/' . basename($filename));
curl_setopt($ch, CURLOPT_NOPROGRESS, false );
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_USERPWD, "user:password");
curl_setopt($ch, CURLOPT_PUT, 1);
$fh_res = fopen($file_path_str, 'r');
curl_setopt($ch, CURLOPT_INFILE, $fh_res);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file_path_str));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
$curl_response_res = curl_exec ($ch);
如果连接中断,如何继续上传?
解决方案
推荐阅读
- java - mysql 连接器没有连接到我的 xxamp localhost
- python-3.x - Python ConfigParser.write() 缺少 1 个必需的位置参数“fp”?
- google-pagespeed - 出现错误 - Lighthouse 返回错误:内部:APP::1:渲染器异常终止,状态 = 崩溃 exit_code = 1
- cplex - Cplex如何在约束中使用变量进行索引
- mysql - MySQL 将一张表连接到另外两张表
- wordpress - Wordpress - woocommerce - myaccount/orders-list.php - 获取产品图片
- metadata - 从自动查询元数据中隐藏类型
- python - 使用 for 循环出现意外的 KeyError,但手动时没有
- angular - 如果我将鼠标悬停在 Plotly 中,如何显示与图例中所述不同的跟踪名称?
- mysql - mysql.createpool 函数是同步的还是异步的?