This is, afaik, not currently supported by pake, and enough of a chore to merit some pake_function of its own (either that, or have it working via pake_write_file).
From my limited web serach, it seems that using curl is better than using the ss2_sftp functions (wider installed base).
$fp = fopen( $randfile, 'rb' );
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, str_replace( 'http://', 'sftp://@', $srv ) . $remotefilename );
if ( $user != "" ) curl_setopt( $ch, CURLOPT_USERPWD, $user );
if ( $public_keyfile != "" ) curl_setopt( $ch, CURLOPT_SSH_PUBLIC_KEYFILE, $public_keyfile );
if ( $private_keyfile != "" ) curl_setopt( $ch, CURLOPT_SSH_PRIVATE_KEYFILE, $private_keyfile );
if ( $private_keypasswd != "" ) curl_setopt( $ch, CURLOPT_KEYPASSWD, $private_keypasswd );
curl_setopt( $ch, CURLOPT_UPLOAD, 1 );
curl_setopt( $ch, CURLOPT_INFILE, $fp );
// set size of the file, which isn't _mandatory_ but helps libcurl to do
// extra error checking on the upload.
curl_setopt($ch, CURLOPT_INFILESIZE, filesize( $randfile ) );
$ok = curl_exec( $ch );
$errinfo = curl_error( $ch );
curl_close( $ch );
fclose( $fp );
if ( !$ok )
{
throw new pakeException( "Couldn't write {$fullfilename} file: " . $errinfo );
}