title: ftp_get() expects parameter 2 to be a valid path, resource given
body: <p>Why am I receiving this error?  According to the <a href="http://php.net/manual/en/function.ftp-fget.php" rel="nofollow">ftp_get docs</a>, the function is defined like so:</p>
  
  <pre><code>bool ftp_fget ( resource $ftp_stream , resource $handle , string $remote_file , int $mode [, int $resumepos = 0 ] )
  </code></pre>
  
  <p>However, when I pass this function a file resource, I receive the error:</p>
  
  <pre><code>ftp_get() expects parameter 2 to be a valid path, resource given
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>$ftp = ftp_connect(FTP_HOST);
  
  if (ftp_login($ftp, FTP_USERNAME, FTP_PASSWORD)) {
      $file = tmpfile();
  
      if(ftp_get($ftp, $file, FTP_FILENAME, FTP_ASCII)) {
          file_get_contents($file);
      }
  }
  </code></pre>
  
  <p>Why is the error suggesting that the function expects a path, when the docs show it defined as expecting a resource? I am using PHP 5.5.9.</p>