- when uploading a file that already exists on the server, the file on the server is now truncated to zero (thanks, guir!)

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@59 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
Jim Wigginton 2009-11-25 20:05:41 +00:00
parent 239f48cc6c
commit 5d1f459db7

View File

@ -48,7 +48,7 @@
* @author Jim Wigginton <terrafrost@php.net>
* @copyright MMIX Jim Wigginton
* @license http://www.gnu.org/licenses/lgpl.txt
* @version $Id: SFTP.php,v 1.10 2009-11-23 19:06:07 terrafrost Exp $
* @version $Id: SFTP.php,v 1.11 2009-11-25 20:05:41 terrafrost Exp $
* @link http://phpseclib.sourceforge.net
*/
@ -281,7 +281,8 @@ class Net_SFTP extends Net_SSH2 {
$this->open_flags = array(
0x00000001 => 'NET_SFTP_OPEN_READ',
0x00000002 => 'NET_SFTP_OPEN_WRITE',
0x00000008 => 'NET_SFTP_OPEN_CREATE'
0x00000008 => 'NET_SFTP_OPEN_CREATE',
0x00000010 => 'NET_SFTP_OPEN_TRUNCATE'
);
$this->_define_array(
$this->packet_types,
@ -835,7 +836,7 @@ class Net_SFTP extends Net_SSH2 {
return false;
}
$packet = pack('Na*N2', strlen($remote_file), $remote_file, NET_SFTP_OPEN_WRITE | NET_SFTP_OPEN_CREATE, 0);
$packet = pack('Na*N2', strlen($remote_file), $remote_file, NET_SFTP_OPEN_WRITE | NET_SFTP_OPEN_CREATE | NET_SFTP_OPEN_TRUNCATE, 0);
if (!$this->_send_sftp_packet(NET_SFTP_OPEN, $packet)) {
return false;
}