Jump to content

Recommended Posts

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;

}

 

 

Link to comment
https://forums.phpfreaks.com/topic/84762-multithreaded-simultaneous-ftp_put/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.