title: phpseclib sftp->put() command: File contents are just a string, not the expected PDF document
body: <p>I'm trying to upload a PDF document from a stage server to a remote location using $sftp-put();</p>
  
  
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>$sftp = new SFTP($config::SFTP_SERVER);
  
  // login to remote server
  if (!$sftp-&gt;login($config::SFTP_USER, $config::SFTP_PASSWORD)) {
      throw new Exception('Login failed');
  }
  
  // move to relevant directory
  $sftp-&gt;chdir('fatca');
  
  // upload file
  $uploadFile = $sftp-&gt;put('test-pdf-upload.pdf', '/srv/www/vhosts/stage.johno.com/fatca/src/uploads/pdfs/345-553453-434__05122017_16:45:26.pdf', NET_SFTP_LOCAL_FILE);
  
  // Error checking for local env only
  var_dump($uploadFile);
  var_dump($sftp-&gt;getSFTPLog());
  </code></pre>
  
  
  
  <p>I'm expecting to view the same PDF, that contains user data and some user uploaded images. I've also confirmed that the original PDF has been created successfully on the staging server, it is intact and shows the relevant information.</p>
  
  
  
  <p>The resulting file is created in the new remote server location however it is damaged/unreadable.</p>
  
  <p>The output from <code>var_dump($sftp-&gt;getSFTPLog());</code> is not encouraging either:</p>
  
  <pre><code>bool(false)
  </code></pre>
  
  <p>What am I doing wrong here? Feel like I've followed the phpseclib documentation well... Although its been one of those long, long days in front of the screen!</p>
  
  <p>Any advice greatly appreciated as always.</p>