1
0
mirror of https://github.com/danog/phpseclib.git synced 2025-01-22 04:51:19 +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;
}
if ($mode == NET_SCP_STRING) {
$this->_send($data);
} else {
for ($i = 0; $i < $size; $i += $this->packet_size) {
$this->_send(fgets($fp, $this->packet_size));
}
fclose($fp);
$sent = 0;
while ($sent < $size) {
$temp = $mode & NET_SCP_STRING ? substr($data, $sent, $this->packet_size) : fread($fp, $this->packet_size);
$this->_send($temp);
$sent+= strlen($temp);
}
$this->_close();
if ($mode != NET_SCP_STRING) {
fclose($fp);
}
return true;
}