title: ftp_put always returning FALSE
body: <p>I'm generating a .csv file from a mysql query and the file is correctly saved on the local server where the creating query is. The next step would be to take that new file and upload it to a different FTP location (completely different server). I've tried almost everything, but I still can't get the ftp_put to work.</p>
  
  <p>Here is the part of my code in question:</p>
  
  <pre><code>//Creating the file
  $file = fopen(dirname(__FILE__) . "/local_export.csv","w");
  
  $csv_line = array("item1","item2");
  
  fputcsv($file,$csv_line);
  
  fclose($file);
  
  $ftp_server = "00.000.000.00";
  $ftp_user_name = "myusername";
  $ftp_user_pass = "mypassword";
  
  $file = dirname(__FILE__) . "/local_export.csv";
  $remote_file = "remote_export.csv";
  
  // set up basic connection
  $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
  
  ftp_pasv($conn_id, true);
  
  // login with username and password
  
  if (ftp_login($conn_id, $ftp_user_name, $ftp_user_pass)) {
  echo "Connected as $ftp_user_name@$ftp_server\n";
  } else {
  echo "Couldn't connect as $ftp_user_name\n";
  }
  
  echo "Current directory: " . ftp_pwd($conn_id) . "\n";
  
  // change the current directory
  if (ftp_chdir($conn_id, "transfer")) {
  echo "Current directory is now: " . ftp_pwd($conn_id) . "\n";
  } else { 
  echo "Couldn't change directory\n";
  }
  
  // upload a file
  if (ftp_put($conn_id, $remote_file, $file, FTP_BINARY)) {
  echo "successfully uploaded $file\n";
  } else {
  echo "There was a problem while uploading $file\n";
  }
  
  // close the connection
  ftp_close($conn_id);
  </code></pre>
  
  <p>In terms of the location of the two files, the local file is in:</p>
  
  <pre><code>http://subdomain.domain/folder/local_export.csv
  </code></pre>
  
  <p>While the remote file is going to go on the root / folder of the server (which is also the only one I have access to).</p>
  
  <p>To me it looks like everything is in order, but still the code only generates the local file, always failing to save it to the remote location. I'm fairly new to moving files around, so I'm sorry in advance if the solution is in front of my eyes but I can't see it!</p>
  
  <p>Many thanks in advance for your help.</p>
  
  <p><strong><em>EDIT:</em></strong> as pointed out in the comments below, I should've checked if the connection to the server is successful or not. I've done those checks. The connection return successful (I've also tried independently via Filezilla to make sure the account I was given is able to upload in that location and it is.). So I guess I'm back at square one. </p>