raimis100 Posted June 30, 2008 Share Posted June 30, 2008 Hey! has anyone here used multi curl for upload or atleast does anybody knows if it is possible to make it work ? Here is the code which I used but I don't understand where the problem is $socketh = curl_multi_init(); foreach ($filepath as $count => $url) { $ftp_url= 'ftp://'.$username.':'.$password.'@'.$FTP.'/'.$sitename.'/'.trim($filename [$count]); echo '<br> URL - '.$ftp_url ."<br>"; $file_to_upload_path = realpath(trim($filepath[$count])); $file_size = filesize($file_to_upload_path); $fp = fopen($file_to_upload_path,'rb'); $socket[$count] = curl_init(); curl_setopt($socket[$count], CURLOPT_URL, $ftp_url); curl_setopt($socket[$count], CURLOPT_UPLOAD, 1); curl_setopt($socket[$count], CURLOPT_INFILE, $fp); curl_setopt($socket[$count], CURLOPT_INFILESIZE, $file_size); //$result = curl_exec ($socket[$count]); curl_multi_add_handle($socketh, $socket[$count]); } $working = NULL; do { $x = curl_multi_exec($socketh, $working); } while ($working); For ($count = 0; $count <= count ($filepath); $count++) { $data[] = curl_multi_getcontent($socket[$i]); curl_close($socket[$i]); echo('<br> <p> uploaded '.trim($filepath[$count])); } Link to comment https://forums.phpfreaks.com/topic/112606-multi-curl-for-upload/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.