简体   繁体   中英

php curl upload percent

I can upload files to different server with this code:

updateproduct($product['id'], 'uploading');
$data['video_file'] = "@".$filepath;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $json['upload_url']);
curl_setopt($ch, CURLOPT_TIMEOUT, 1550);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 

I want to update database every percent. updateproduct function updates database. How can I get current upload percent?

使用curl回调来进度表功能: CURLOPT_XFERINFOFUNCTION

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM