cms server Posted January 6, 2008 Share Posted January 6, 2008 Hi, I am able to transfer with no problems using: ftp_put I have multiple files that are found locally in different locations and then transfer consecutively, the transfers are registering slowly one after another on the FTP server (each one has to complete first). The server is multithreaded and could handle lots of simultaneous transfers. How do I start an FTP transfer to work in background and then move on to starting the other FTP transfers in this loop? if (ftp_put($fp, $remotevar, $src, FTP_BINARY)) { $success = true; $sizefile = (filesize($src) < 1024 ? 0 : ((filesize($src) / 1024) / ((time() +1) - $filestart))); echo "[" . strftime("%d/%m/%Y %H:%M:%S", time()) . "] <= file transfer finished! [@ " . sprintf("%.2f kb/s", $sizefile) . "]\n"; } else { echo "[" . strftime("%d/%m/%Y %H:%M:%S", time()) . "] =! transfer failed from $src to {$ftp_server['remotePath']}{$destname}\n"; $success = false; } } else { echo "[" . strftime("%d/%m/%Y %H:%M:%S", time()) . "] =! No transfer required file is current \n"; $success = false; } echo "[" . strftime("%d/%m/%Y %H:%M:%S", time()) . "] <= closed connection\n"; ftp_quit($fp); $servar++; } echo "[" . strftime("%d/%m/%Y %H:%M:%S", time()) . "] done!\n"; return $success; } Quote Link to comment https://forums.phpfreaks.com/topic/84762-multithreaded-simultaneous-ftp_put/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.