I've a php script that pushes large media files to a remote server via FTP. This is working smoothly. I would like to enhance this and make it report back to a ajax client that initiates the transfers. Basically, report back something like below after each transfer:
1/12: File xbacd.dat has been copied successfully to /dir1/sub2/ - 2.2Mb
2/12: File impact_analy.ppt was not found in /var/www/files - Resuming.
3/12: File abc_consult.doc has been copied successfully to /dir1/sub3/ - 8.2Mb
Ajax handler on the other hand should be displaying this in a div, as and when it arrives.
I had no luck with the following code, and hence switching over to AJAX.
ob_start();
require_once 'init.php';
while(files){
// Transfer code
// status
echo "$idx/$count: File $f has been copied successfully to $tar_dir - $s";
ob_flush;
flush;
}