title: PHP: Using ftp_put results in an error, how find reason?
body: <p>I am creating an export file using PHP. After the file is created, I wish to move it to another ftp-location. The file creation goes well, also the ftp-connection seems to go well, but the transfer/uploading of the file results in an error. </p>
  
  <p>I have checked the credentials and path using Filezilla and believe the FTP path is good.</p>
  
  <p>What goes wrong with this code or how can I get more feedback from the code to find the reason it results in an error?</p>
  
  <p>This is part of the code. I pick it up after the file creation is done (so this all happens in the same file):</p>
  
  <pre><code> fclose($myfile);
  
   $conn-&gt;close();
  
  //Move file to ftp-server
  $ftp_server = "ftp.domain.com";
  $ftp_username = "username"; 
  $ftp_userpass = "password"; 
  $ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
  $login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
  $remote_location = "/public_html/testdir";
  $file = "export.csv";
  
  // upload file
  if (ftp_put($ftp_conn, $remote_location, $file, FTP_ASCII))
    {
    echo "Successfully uploaded $file.";
    }
  else
    {
    echo "Error uploading $file.";
    }
  
  // close connection
  ftp_close($ftp_conn);
  </code></pre>
  
  <p>So the error I get is: "Error uploading export.csv." The file exists in the same directory as the php file that is running the code.</p>
  
  <p>Please be gentle...</p>