title: Using laravel SSH to upload files to another server
body: <p>Revised:</p>
  
  <p>I have an uploaded file that I would like to move to my other server for processing with another application. I thought the best way would be to use SSH built into Laravel however, it's proven to be a headache. </p>
  
  <p>In my configuration file (remote.php), I've successfully set up my connection to my other server using SSH keys. I tested this by running </p>
  
  <pre><code>SSH::run(['cd /var/www/html', 'ls'], function($line) {
  
      echo $line . PHP_EOL;    
  
  });
  </code></pre>
  
  <p>and it gave me a list of files in <code>/var/www/html/</code> on my remote server. All seems good, right?</p>
  
  <p>Now I want to use <code>SSH::put()</code> to upload my uploaded file to the remote server. I used:</p>
  
  <p><code>SSH::put($file-&gt;getRealPath(), '/var/www/html/uploads');</code></p>
  
  <p>Guess what? It ran without an error so I assumed it was uploaded successfully. When I checked that directory on the remote server, it was blank. I've tried to set file permissions to 777 on <code>/var/www/html/uploads</code> to see if it was a permission issue, same thing--nothing. </p>
  
  <p>I also tried using <code>SSH::get()</code> to download a file from my remote server and it ran successfully. </p>
  
  <p>Here's a dump on <code>$file-&gt;getRealPath()</code>:</p>
  
  <p><code>string(14) "/tmp/phpikt2mg"</code></p>
  
  <p>Both machines are running Centos and have their public keys registered on both ends. </p>