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:
parent
bafbf1276e
commit
56f1b6f411
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user