title: Uploading a file from local to server through FTP using PHP
body: <p>I would like to upload a file to server from my local. I have tried following code but it is giving some error. Please help me to resolve</p>
  
  <pre><code>&lt;?php 
  $server="115.120.147.261";
  $ftp_user_name="root";
  $ftp_user_pass="3424dd";
  $dest="/home/root/web/Price-War/";
  $source="/home/root/sample.txt";
  $connection = ftp_connect($server);
  if($connection)
  {
  echo "Connection Established";
  }
  $login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);
  
  if (!$connection || !$login) { die('Connection attempt failed!'); }
  
  $upload = ftp_put($connection, $dest, $source, FTP_ASCII);
  
  if (!$upload) { echo 'FTP upload failed!'; }
  
  ftp_close($connection);
  ?&gt;
  </code></pre>
  
  <p>Its throwing following error.</p>
  
  <pre><code>Connection Established
  PHP Warning:  ftp_put(): Could not create file. in /home/root/Desktop/upload.php on line 16
  </code></pre>