Resumable upload with CURL in owncloud

风流意气都作罢 提交于 2019-12-13 12:47:44

问题


I am uploading my files to owncloud using curl request. If connection interrupts how can resume the upload? because i have to upload large files. Below is my code

    $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);

How to continue the upload if the connection interrupts?

来源:https://stackoverflow.com/questions/58340588/resumable-upload-with-curl-in-owncloud

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!