Help for this page
do { $ftp->restart($transferred); ... } while($written<$to_transfer); $transferred+=$written;