I have a folder which has 2 files.When I am running the below code, it works for the first loop but second time onwards it fails with the warning as - Warning: ssh2_scp_send(): Failure creating remote file: Unexpected channel close in /var/www/html/..../newCheck.php
Also i am running this on a Linux platform and trying to transfer file to Windows(destination).
foreach($results as $key => $val) {
if(!is_dir($val)) {
$valArr = explode('/',$val);
$filename = array_pop($valArr);
ssh2_scp_send($conn,'/var/www/html/Portal/'.$filename, 'D:/'.$filename, 0644);
}
}
Any Idea?