1
0
mirror of https://github.com/danog/phpseclib.git synced 2025-01-22 13:01:59 +01:00

SCP: better binary local file support for put()

This commit is contained in:
terrafrost 2013-09-04 02:14:36 -05:00
parent bafbf1276e
commit 56f1b6f411

View File

@ -206,16 +206,18 @@ class Net_SCP {
return false; return false;
} }
if ($mode == NET_SCP_STRING) { $sent = 0;
$this->_send($data); while ($sent < $size) {
} else { $temp = $mode & NET_SCP_STRING ? substr($data, $sent, $this->packet_size) : fread($fp, $this->packet_size);
for ($i = 0; $i < $size; $i += $this->packet_size) { $this->_send($temp);
$this->_send(fgets($fp, $this->packet_size)); $sent+= strlen($temp);
}
fclose($fp);
} }
$this->_close(); $this->_close();
if ($mode != NET_SCP_STRING) {
fclose($fp);
}
return true; return true;
} }