title: How to upload images from one server to another using php
body: <p>I have a php file to upload an image. while uploading image i need to upload the same image to another server also. I tried with php ftp. but it showing an error unable to connect ftp.  how to solve this error? or any other method to do this.  </p>
  
  <p>my ftp connection code is   </p>
  
  <pre><code>$ftp_server="";
  $ftp_user_name="";
  $ftp_user_pass="";
  
  $conn_id = ftp_connect($ftp_server);
  
  $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
  if ((!$conn_id) || (!$login_result)) {
      echo "FTP connection has failed!";
      echo "Attempted to connect to $ftp_server for user $ftp_user_name";
      die;
  } else {
      echo "&lt;br&gt;Connected to $ftp_server, for user $user&lt;br&gt;";
  }
  </code></pre>
  
  <p>Iam using shared hosting server</p>