S skinner Active Member 741 2010 59 5,200 Mar 8, 2012 #1 Hi, I'm using that comand to upload to ftp with php: PHP: ftp_put($connect, $destination_file, $source_file, FTP_BINARY) but how can I reup that file, for example max 5 times, if upload failed? Thanks
Hi, I'm using that comand to upload to ftp with php: PHP: ftp_put($connect, $destination_file, $source_file, FTP_BINARY) but how can I reup that file, for example max 5 times, if upload failed? Thanks
D deliteblogger Active Member 331 2011 116 0 Mar 8, 2012 #2 http://www.w3schools.com/php/func_ftp_put.asp http://php.net/manual/en/function.ftp-put.php This function returns TRUE on success and FALSE on failure. Click to expand... PHP: $ok=false; $tries=0; while (!$ok && $tries<4) { $tries++; if (ftp_put($connect, $destination_file, $source_file, FTP_BINARY)) $ok=true; }
http://www.w3schools.com/php/func_ftp_put.asp http://php.net/manual/en/function.ftp-put.php This function returns TRUE on success and FALSE on failure. Click to expand... PHP: $ok=false; $tries=0; while (!$ok && $tries<4) { $tries++; if (ftp_put($connect, $destination_file, $source_file, FTP_BINARY)) $ok=true; }
eCoder Banned Banned 31 2011 8 0 Mar 8, 2012 #3 PHP: $i = 1 for ($i = 1; $i<6;i++) { if (!(ftp_put($connect, $destination_file, $source_file, FTP_BINARY))) { $i++; if ($i >= 5) { break; } }else{ break; } } Last edited: Mar 9, 2012
PHP: $i = 1 for ($i = 1; $i<6;i++) { if (!(ftp_put($connect, $destination_file, $source_file, FTP_BINARY))) { $i++; if ($i >= 5) { break; } }else{ break; } }