libssh2 - php sftp using ssh2 corrupting pdf files -
i'm trying transfer pdf file our server via sftp. i've checked files , not inherently corrupt. can scp them on command line computer , open fine. note: can transfer pdf file, corrupted once gets other server.
i've tried using 2 methods:
conn = ssh2_connect($url, 22); $auth = ssh2_auth_password($conn, $username, $password); $sftp = ssh2_sftp($conn); file_put_contents("ssh2.sftp://".$sftp.$remotefilepath, $localfilepath); after looking @ question, came upon below question , tried given answer:
ssh2_scp_send() using php corrupts pdf
conn = ssh2_connect($url, 22); $auth = ssh2_auth_password($conn, $username, $password); $sftp = ssh2_sftp($conn); $fp = fopen("ssh2.sftp://".$sftp.$remotefilepath, "w"); fwrite($fp, $localfilepath); fclose($fp); this transfers file, corrupted cannot open in ftp gui once in server.
i'm aware of other php extension this. i'll try out if can't work i've put enough time this, , should work. thoughts?
look @ http://php.net/manual/en/function.ssh2-scp-send.php
and try:
$conn = ssh2_connect($url, 22); $auth = ssh2_auth_password($conn, $username, $password); ssh2_scp_send($conn, $localfilepath, $remotefilepath, 0644);
Comments
Post a Comment